diff --git a/backbone.js b/backbone.js index c0fa4774..91caaeb1 100644 --- a/backbone.js +++ b/backbone.js @@ -299,7 +299,7 @@ // Get a model from the set by id. get : function(id) { - return id && this._byId[id.id || id]; + return id && this._byId[id.id != null ? id.id : id]; }, // Get a model from the set by client id. @@ -322,16 +322,17 @@ return this.models[index]; }, - // Add a model, or list of models to the set. Pass silent to avoid firing - // the `added` event for every new model. - add : function(models, silent) { - if (!_.isArray(models)) return this._add(models, silent); - for (var i=0; i