mirror of
https://github.com/jashkenas/backbone.git
synced 2026-01-23 22:08:04 -05:00
slightly saner validation on initialize.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user