icereval/backbone-documentmodel

Incorrect model hierarchy when setting 2-dimensional array

Dema opened this issue · 2 comments

Dema commented

Here is the problem:

test("setting nested array to existing model",2,function(){
    var model = new Backbone.DocumentModel({items:[]});
    model.set('items', [[1],[2]]);
    equal(model.get('items.0') instanceof Backbone.Model, false);
    equal(model.get('items.0') instanceof Backbone.Collection, true);
});

both tests failed
It actually creates Backbone.Model object with keys 0 and 1. Is this an expected behaviour?

Issues should now be resolved in 0.6.1, specifically commit 324f5e6

Dema commented

Thanks!