Skip to content

Commit

Permalink
Remove .create and #update methods as they suggest that they act like…
Browse files Browse the repository at this point in the history
… ActiveRecord's .create and #update_attributes which is not quite the case - they don't trigger any calls on the persistence adapter.
  • Loading branch information
benpickles committed Sep 15, 2010
1 parent dd2ddf6 commit df12529
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 21 deletions.
6 changes: 0 additions & 6 deletions src/model_class_methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ Model.ClassMethods = {
return this.collection.length;
},

create: function(attributes) {
var model = new this(attributes)
this.add(model)
return model
},

detect: function(func) {
var all = this.all(),
model
Expand Down
5 changes: 0 additions & 5 deletions src/model_instance_methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ Model.InstanceMethods = {
return this;
},

update: function(attributes) {
this.merge(attributes).trigger("update");
return this;
},

valid: function() {
this.errors.clear();
this.validate();
Expand Down
10 changes: 0 additions & 10 deletions test/tests/model_class_methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,3 @@ test("reverse", function() {

same(Post.reverse().all(), [post2, post1])
})

test("create", function() {
var Post = Model("post")
var post = Post.create({ title: "blah" })

equals(Post.count(), 1)
same(post, Post.first())
same(post.attributes, Post.first().attributes)
equals(post.attributes, Post.first().attributes)
})

0 comments on commit df12529

Please sign in to comment.