allow the passing of any number of arguments to Model#initialize

This commit is contained in:
Jeremy Ashkenas
2012-01-13 16:10:14 -05:00
parent 5aa4fda9ba
commit 4316b04ffa
2 changed files with 2 additions and 2 deletions

View File

@@ -158,7 +158,7 @@
this.set(attributes, {silent : true});
this._changed = false;
this._previousAttributes = _.clone(this.attributes);
this.initialize(attributes, options);
this.initialize.apply(this, arguments);
};
// Attach all inheritable methods to the Model prototype.

View File

@@ -424,7 +424,7 @@ $(document).ready(function() {
var Defaulted = Backbone.Model.extend({
defaults: {one: 1},
initialize : function(attrs, opts) {
equals(attrs.one, 1);
equals(this.attributes.one, 1);
}
});
var providedattrs = new Defaulted({});