Skip to content

Commit

Permalink
Merge pull request #1200 from ymichael/master
Browse files Browse the repository at this point in the history
Issue 1173: (todo example) model ids are not properly indexed by collections on creation
  • Loading branch information
jashkenas committed Apr 6, 2012
2 parents 1bd9b7c + f71bc0d commit e2c5ce8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/backbone-localstorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ _.extend(Store.prototype, {
// Add a model, giving it a (hopefully)-unique GUID, if it doesn't already
// have an id of it's own.
create: function(model) {
if (!model.id) model.id = model.attributes.id = guid();
if (!model.id) model.set(model.idAttribute, guid());
this.data[model.id] = model;
this.save();
return model;
Expand Down

0 comments on commit e2c5ce8

Please sign in to comment.