-
Notifications
You must be signed in to change notification settings - Fork 37
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
Use included resource when serialising it’s links #130
Conversation
Thanks so much for contributing! Can you provide an example of a url that was wrong, and what you would expect? It's not immediately clear from your description. |
Sure, given the following entities and Resources
And the following controller method
The response will be...
Notice that the relationship link URLs for the included Author resource are formatted as if they were a Book. My PR hopefully addresses this within ResourceSerializer by passing around the current resource being serialised, instead of referring to the _resource it was instantiated with. |
I see, so Can you add a test for this so we don't have a regression later? |
That's it, no worries, test included in latest commit. |
@laurence79 Awesome! thank you so much. I'll publish a pre-release with this fix in it. |
Hey, I'd love to start using the updated lib in my projects, can I help with the release? |
Whilst working on an Ember Data app, I noticed that Saule was using the root resource's URL path when generating links for included resources, rather than using the URL path of the included resource. This PR fixes this in my case.