Created
February 7, 2012 00:31
-
-
Save karlwestin/1756183 to your computer and use it in GitHub Desktop.
Overriding set-method in Backbone.js models
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set: function(attrs, options) { | |
_.each(attrs, function(val, key) { | |
if(!!this.validations[key]) | |
attrs[key] = this.filters[ this.validations[key].filter ](val); | |
}, this); | |
Backbone.Model.prototype.set.call(this, attrs, options); | |
return this; | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment