slightly saner validation on initialize.

This commit is contained in:
Jeremy Ashkenas
2011-07-01 11:49:19 -04:00
parent e67422ad7e
commit ddf1a833ab

View File

@@ -566,8 +566,8 @@
_prepareModel: function(model, options) {
if (!(model instanceof Backbone.Model)) {
var attrs = model;
model = new this.model(null, {collection: this});
if (!model.set(attrs, options)) model = false;
model = new this.model(attrs, {collection: this});
if (model.validate && !model._performValidation(attrs, options)) model = false;
} else if (!model.collection) {
model.collection = this;
}