Skip to content

Commit

Permalink
tweaking duplicate model merge:true
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Apr 23, 2012
1 parent 9ee0358 commit b42cc64
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,12 @@
model.trigger('add', model, this, options);
}

// Merge in duplicate models.
if (options.merge) {
for (i = 0, length = dups.length; i < length; i++) {
model = this._byId[dups[i].id] || this._byCid[dups[i].cid];
model.set(dups[i], options);
if (model = this._byId[dups[i].id]) {
model.set(dups[i], options);
}
}
}

Expand Down

0 comments on commit b42cc64

Please sign in to comment.