Merge pull request #503 from cdmwebs/master

Revert 495's behavior with tests
This commit is contained in:
Jeremy Ashkenas
2011-07-25 15:26:19 -07:00
2 changed files with 3 additions and 1 deletions

View File

@@ -342,7 +342,7 @@
// A model is new if it has never been saved to the server, and lacks an id.
isNew : function() {
return this[this.idAttribute] == null;
return this.id == null;
},
// Call this method to manually fire a `change` event for this model.

View File

@@ -175,8 +175,10 @@ $(document).ready(function() {
var model = new MongoModel({id: 'eye-dee', _id: 25, title: 'Model'});
equals(model.get('id'), 'eye-dee');
equals(model.id, 25);
equals(model.isNew(), false);
model.unset('_id');
equals(model.id, undefined);
equals(model.isNew(), true);
});
test("Model: set an empty string", function() {