mirror of
https://github.com/jashkenas/backbone.git
synced 2026-01-22 21:38:00 -05:00
allow the passing of any number of arguments to Model#initialize
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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({});
|
||||
|
||||
Reference in New Issue
Block a user