Skip to content

Commit

Permalink
Error methods should be chainable where possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
benpickles committed Sep 15, 2010
1 parent 659aa09 commit bc7fee0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/model_errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Model.Errors.prototype = {
add: function(attribute, message) {
if (!this.errors[attribute]) this.errors[attribute] = [];
this.errors[attribute].push(message);
return this
},

all: function() {
Expand All @@ -15,6 +16,7 @@ Model.Errors.prototype = {

clear: function() {
this.errors = {};
return this
},

each: function(func) {
Expand All @@ -23,6 +25,7 @@ Model.Errors.prototype = {
func.call(this, attribute, this.errors[attribute][i]);
}
}
return this
},

on: function(attribute) {
Expand Down

0 comments on commit bc7fee0

Please sign in to comment.