-
-
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
handleFindAll() mockjax return always includes embedded reccords #134
Comments
you puzzle me @Andrew-Max Would be nice if you laid this out alittle better ( more detail ) . |
Fixed! I am not a smart man ... Site should have been flight |
whew .. was about to call my mommy and start crying .. thanks for saving me the embarrasment :) |
@danielspaniel Sorry I should have specified, I fixed the typo in the original issue but I did not actually resolve the issue. One thing which I did find solves the issue is to change But that doesn't match up with the documentation. Any thought on whether or not that makes sense? |
what version are you using of factory guy/ ember data?? |
with: I get: with:
Which seems to match up with what I would expect |
what do your models look like? |
map model:
flight model:
|
second one is flight .. I reckon. Looks fine. |
Yes, I will give that a go and report back later today. I really appreciate all the help. |
Upgrading to 2.0.3 fixed this issue! Many thanks @danielspaniel |
hooray .. I am glad you back in business! :) |
I have two models: map and flight.
When I call:
I get an error
Error: Assertion Failed: Ember Data expected a number or string to represent the record(s) in the
flightrelationship instead it found an object. If this is a polymorphic relationship please specify a
typekey. If this is an embedded relationship please include the
DS.EmbeddedRecordsMixinand specify the
flightproperty in your serializer's attrs object.
My Flight factory:
My test:
Because a flight object is embedded in the returned record instead of the id which the serializer is looking for.
If I create a custom serializer for map which specifies that flights should be embedded with DS.EmbeddedRecordsMixin, this error goes away but I can't do this because my backend does not embed that record so the app breaks.
As far as I can see I have two options:
Create a test only serializer for flight which seems undesirable and I wouldn't even know how to do it.
Prevent mockjax from embedding the flight record and ask factory-guy to create it seperately.
Are either of these feasible or am I missing something here?
The text was updated successfully, but these errors were encountered: