Implements support for handling inverse relationships with toMany attrib... #875

Closed
wants to merge 4 commits into from

1 participant

@nicolasbadia
SproutCore member

...ute

This is already handle if we get the toMany attribute of a record and
use pushObject. Like this: bar1.get('fooToMany').pushObject(foo2);

We this commit, the inverse relationships is also notify if we directly
set the attribute with an array. Like this:
bar1.set('fooToMany', [foo2, foo3]);

nicolasbadia added some commits Jan 4, 2013
@nicolasbadia nicolasbadia Implements support for handling inverse relationships with toMany att…
…ribute

This is already handle if we get the toMany attribute of a record and
use pushObject. Like this: bar1.get('fooToMany').pushObject(foo2);

We this commit, the inverse relationships is also notify if we directly
set the attribute with an array. Like this:
bar1.set('fooToMany', [foo2, foo3]);
ac2e362
@nicolasbadia nicolasbadia Fix the return value dd7a17f
@nicolasbadia nicolasbadia Add the ability to pass an SC.ManyArray or a null value
isSCArray is now used to check if the newRecords variable is an array.
This avoid an exception if we pass an SC.ManyArray because SC.typeOf
return 'object'.
If we pass null, transform it to an empty array. This will remove the
inverses relationship.
7d5e57c
@nicolasbadia
SproutCore member

Add the ability to pass an SC.ManyArray or a null value as attribute. Also add units tests for that.

@nicolasbadia
SproutCore member

Closed by #1147

@nicolasbadia nicolasbadia deleted the nicolasbadia:many-attribute branch Dec 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment