From 4316b04ffa75257e9eec9fe46b3c48535b659936 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Fri, 13 Jan 2012 16:10:14 -0500 Subject: [PATCH] allow the passing of any number of arguments to Model#initialize --- backbone.js | 2 +- test/model.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backbone.js b/backbone.js index 965c5ba2..c5d67968 100644 --- a/backbone.js +++ b/backbone.js @@ -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. diff --git a/test/model.js b/test/model.js index afac04f7..ea7ac80a 100644 --- a/test/model.js +++ b/test/model.js @@ -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({});