Closed myabc closed 7 years ago
From @jtzero on July 20, 2016 0:15
has_many :stores do type :stores property :id link :self do "http://localhost:3000/stores/#{represented.id}" end end
produces
"relationships"=> {"stores"=> {"data"=>[ {"type"=>"stores", "id"=>"1"}, {"type"=>"stores", "id"=>"2"}, {"type"=>"stores", "id"=>"3"} ], "links"=>{"self"=>"http://localhost:3000/stores/3"} } }, "links"=>{"self"=>"://localhost:3000/retailers/9"}}, "included"=> [ {"type"=>"stores", "id"=>"1", "links"=>{"self"=>"http://localhost:3000/stores/1"}}, {"type"=>"stores", "id"=>"2", "links"=>{"self"=>"http://localhost:3000/stores/2"}}, {"type"=>"stores", "id"=>"3", "links"=>{"self"=>"http://localhost:3000/stores/3"}} ] }
the links are correct in the "included" but the one in "stores" is incorrect,and changing the self link in has_many changes all the ones in the 'included'. How do I change the one in stores?
has_many
Copied from original issue: trailblazer/roar#194
Reference: http://jsonapi.org/format/#document-resource-object-relationships
@jtzero I'm not sure if this issue is still relevant for you, but if it is, I'd appreciate feedback on this fix.
From @jtzero on July 20, 2016 0:15
produces
the links are correct in the "included" but the one in "stores" is incorrect,and changing the self link in
has_many
changes all the ones in the 'included'. How do I change the one in stores?Copied from original issue: trailblazer/roar#194