PaulUithol/Backbone-relational — Issue #72: Problems with models which have a polymorphic relationship.
Author: dlikhten
Created: 2012-02-01 18:19:27+00:00
State: open

Let us say I have a Foo and a Bar object. Both of them have many locations. Both define their relationship:

{ key: "locations", type: "HasMany", model: Location, reverseRelationship: {key: "locatable"}}

This will not work. Basically one of the models (first defined) will not get any locations children added, but will have the relationship. However it should be perfectly valid to do this:

var foo = new Foo(...); foo.get('locations')[0].get('locatable') == foo; // true
var bar = new Bar(...); bar.get('locations')[0].get('locatable') == bar; // true