ember-parse-adapter icon indicating copy to clipboard operation
ember-parse-adapter copied to clipboard

Add tests for addition and removal from a hasMany relationship

Open mixonic opened this issue 10 years ago • 6 comments

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

mixonic avatar Sep 14 '14 13:09 mixonic

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?

lacek avatar Sep 20 '14 11:09 lacek

@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.

mixonic avatar Sep 20 '14 17:09 mixonic

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

lacek avatar Oct 13 '14 13:10 lacek

Do we have any plan to merge this stuff?

quantuminformation avatar Feb 25 '15 14:02 quantuminformation

The reason this pull request contains merge conflicts that must be resolved, beyond the obvious understanding of what that means, is because https://github.com/clintjhill/ember-parse-adapter/pull/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.

notmessenger avatar Mar 20 '15 13:03 notmessenger

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.

igorsantos07 avatar Jun 01 '15 05:06 igorsantos07