Move collection assignment a few lines up so this.collection is available in Model.parse

This commit is contained in:
David Marble
2012-06-13 14:52:42 -04:00
parent 2cd5818fa2
commit 6a39bfd8f3

View File

@@ -178,11 +178,11 @@
var Model = Backbone.Model = function(attributes, options) {
var defaults;
attributes || (attributes = {});
if (options && options.collection) this.collection = options.collection;
if (options && options.parse) attributes = this.parse(attributes);
if (defaults = getValue(this, 'defaults')) {
attributes = _.extend({}, defaults, attributes);
}
if (options && options.collection) this.collection = options.collection;
this.attributes = {};
this._escapedAttributes = {};
this.cid = _.uniqueId('c');