documentcloud/backbone — Issue #681: add specific model to collection with "inside collection" corruption.
Author: wwwsevolod
Created: 2011-10-20 06:51:34+00:00
State: open

when adding model, that contains collection in it (in one of that model attributes), to collection, this "inner collection" (in one of that model attributes) became simple array of objects(models in this "inner collection" became simple objects that contains only model attributes).

Example of code:

var model = new Backbone.Model({
innerCollection: new Backbone.Collection()
})
model.get('innerCollection').add([new Backbone.Model({someAttr: 'shithappens'})])
var outerCollection = new Backbone.Collection([model]);