-
Notifications
You must be signed in to change notification settings - Fork 51
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
Add tests for addition and removal from a hasMany relationship #49
base: master
Are you sure you want to change the base?
Conversation
I wonder why this would work. I see there that |
@lacek _deletedItems may have been an old, old Ember-Data thing. There has been some recent work by @igorT that may bring something similar back, but I think we are stalled until we can get the feature re-introduces upstream. For that matter, I'm not sold that the original code worked exactly as you would expect it to. I think it sent create operations for relationships that already existed when saving a record. |
|
||
if (hasMany && hasMany.get("length")) { |
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.
It doesn't make sense to check hasMany
or its length as you have already checked on line 170.
Do we have any plan to merge this stuff? |
The reason this pull request contains merge conflicts that must be resolved, beyond the obvious understanding of what that means, is because #54 converted this library into an Ember CLI Addon. That means that the structure of the library this pull request was written against no longer exists and the changes will need to be applied to the new code locations. |
Any plans on fixing this? Be it the author or the maintainers? This is a huge issue, as removed items don't... get removed. |
Refactor
serializeHasMany
to be simpler and more correct. Enable a test for adding to a hasMany, add a test for removal from a hasMany.I'm not convinced the conditionals in the
serializeHasMany
function are correct. The items iterated for the add operation seem to just be all items in the relationship. The property iterated for the deletion operation I believe is never set (hence the failing test). I think we need some other method to see changes to the relationship instead of just checking its current state during serialization./cc @igorT