Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mixonic
Copy link
Collaborator

@mixonic mixonic commented Sep 14, 2014

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

@lacek
Copy link

lacek commented Sep 20, 2014

I wonder why this would work. I see there that hasMany._deletedItems is used to track models removed from hasMany relationship, but when I search deletedItems in Ember Parse Adapter, Ember Data, Ember and Parse JS SDK, I got 0 results. So where is hasMany._deletedItems being set?

@mixonic
Copy link
Collaborator Author

mixonic commented Sep 20, 2014

@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")) {
Copy link

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.

@lacek
Copy link

lacek commented Oct 13, 2014

@mixonic _deletedItems is not Ember Data stuff, it originates from this project and is removed in #21 by you for some reason.

@quantuminformation
Copy link

Do we have any plan to merge this stuff?

@notmessenger
Copy link
Contributor

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.

@igorsantos07
Copy link

Any plans on fixing this? Be it the author or the maintainers? This is a huge issue, as removed items don't... get removed.
Refs #75.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants