Created
August 4, 2011 07:46
-
-
Save ivzhao/1124673 to your computer and use it in GitHub Desktop.
Backbone.Collection bug?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_prepareModel: function(model, options) { | |
if (!(model instanceof Backbone.Model)) { | |
var attrs = model; | |
// Bug? Do we forget to pass in options here? | |
model = new this.model(attrs, {collection: this}); | |
// Proposed Fix: | |
//model = new this.model(attrs, _.extend(options, {collection: this})); | |
if (model.validate && !model._performValidation(attrs, options)) model = false; | |
} else if (!model.collection) { | |
model.collection = this; | |
} | |
return model; | |
}, | |
model = new this.model(attrs, _.extend(options, {collection: this})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment