-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Guard for embedded unknown hasMany relationship #3126
Conversation
|
||
deepEqual(json, { | ||
name: "Villain League", | ||
villains: [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really what we want? (since the relationship is "unknown")
For other serializers it would make sense to exclude unknown relationships from the payload to prevent overwriting. Might not be necessary for embedded since it should be present, c?
ping @igorT @jakesjews
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do agree that an embedded relationship should always be present but a developer might not necessarily be in control of the API. An alternative could perhaps be an assert so it's easier to debug.
2a153a6
to
98b96cd
Compare
@igorT @jakesjews updated with a warning, still embedding it as an empty array. |
json[key] = snapshot.hasMany(attr).map(function(embeddedSnapshot) { | ||
hasMany = snapshot.hasMany(attr); | ||
|
||
Ember.warn("The relationship '" + key + "' is unknown for '" + snapshot.modelName + "' with id '" + snapshot.id + "'. Please include it in your original payload.", Ember.typeOf(hasMany) !== 'undefined'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably mention that it's an embedded relationship, and say undefined instead of unknown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Thanks! |
98b96cd
to
7c21fc8
Compare
7c21fc8
to
d92c6ed
Compare
Guard for embedded unknown hasMany relationship
Will this be tagged soon? This is the only thing preventing me from updating my application to Ember v1.12.1. Thanks! |
Same here! |
Yeah, there have been a lot of changes recently. The plan is to get a release out this week. |
Closes #3071