Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'links' in 'relationships' only printing last item in collection #5

Closed
myabc opened this issue Dec 10, 2016 · 2 comments
Closed

'links' in 'relationships' only printing last item in collection #5

myabc opened this issue Dec 10, 2016 · 2 comments
Assignees
Labels

Comments

@myabc
Copy link
Collaborator

myabc commented Dec 10, 2016

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?

Copied from original issue: trailblazer/roar#194

@myabc
Copy link
Collaborator Author

myabc commented Jan 4, 2017

@myabc myabc added the bug label Jan 5, 2017
@myabc myabc closed this as completed in 77ebfc9 Jan 5, 2017
@myabc
Copy link
Collaborator Author

myabc commented Jan 5, 2017

@jtzero I'm not sure if this issue is still relevant for you, but if it is, I'd appreciate feedback on this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant