-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
FactoryGuy.make() doesn't handle ID relationships, Ember Data does #166
Comments
Thanks for PR, and this is good point, since ED will return that record. The only thing that I would like is a test or two ( to show failure without your change ) to make sure it stays working in the future. If you can slap those tests in the PR I'd be much obliged. |
A test or two has revealed this is slightly more complicated than I initially thought. Will re-do the pull request by next week (with appropriate tests). Happy holidays! |
I added several tests, only handle strings and numbers as IDs, and assert the relationship isn't polymorphic. |
Return fixture relationship IDs if not an object (fix #166)
If I do this (with parent.children being a hasMany relationship to child):
JSONAPIFixtureConverter.extractRelationships()
returns undefined for these relationships.However, Ember Data itself will look up these IDs and replace them with the child records, if FactoryGuy wasn't replacing the IDs with undefined. Based on the Ember Data behavior - and this worked for our project with Factory Guy 0.9.1 - it seems simple enough to fix.
I'll prepare a pull request, let me know if you have further insight into this.
The text was updated successfully, but these errors were encountered: