PaulUithol/Backbone-relational — Issue #74: Cannot propperly duplicate an object, if reverseRelationship exists...
Author: dlikhten
Created: 2012-02-03 17:31:03+00:00
State: open

If I have a relationship: Foo HasMany Bars. And there is a reverseRelationship specified we have a major problem if I have 2 Foo objects (same id, in fact its the same object in memory twice). What winds up happening is only one of them will have the bars, the other will have nothing.

On one hand I see why this is desired: Your desire is to share the same instance of Bar, and just reference to it by multiple reverse relationships. And obviously having 2 foos, the reverse relationship won't know which Foo to go to given just 1 object. Currently, by removing the reverseRelationship, there is no problem as there is no confusion as to who the parent is.

Does this go against the BackboneRelational approach?