-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
In nested hasOne and hasMany associations, it's useful to have the associated objects have pointers back to the origin object. This can't be done by overriding init since the object won't have been fetched and thus the associated objects may not exist. It can't be done by overriding the association method and calling _super because the association is defined first in this class, not a parent.
I suggest the following:
Owner = Ember.Resource.define({
foo: {
type: 'Foo',
nested: true,
inverse: 'owner'
},
bars: {
type: Ember.ResourceCollection,
itemType: 'Bar',
nested: true,
inverse: 'owner'
}
});This would declare owner properties on the associated Foos and Bars. For example
someOwner.getPath('foo.owner') === someOwner; // trueMetadata
Metadata
Assignees
Labels
No labels