Created
June 14, 2011 20:32
-
-
Save johnbintz/1025803 to your computer and use it in GitHub Desktop.
Make Backbone report validation errors, much like @model.save! in Rails
This file contains hidden or 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
class Backbone.ValidatingModel extends Backbone.Model | |
_performValidation: (attrs, options = {}) -> | |
_options = _.clone(options) | |
_options.error = (model, error, opts) -> | |
throw new Error(error) | |
super(attrs, _options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment