backbone.validations
backbone.validations copied to clipboard
Question about overriding Backbone.Model
First of all, great library. I'm finding it very useful.
I'm curious as to why you chose to override Backbone.Model instead of just keeping your version in it's own namespace (I do see there's a noConflict).
It just looks like the code might be little cleaner if you just used Backbone's extend and overrode the validate
and _performValidation
functions. You also wouldn't have to check if validate
was an object because you wouldn't have to support the original way of doing validations.
I personally prefer to use your noConflict version, because that way when I extend Backbone.Validations.Model
I'm clearly telling myself what behavior to expect from the model.
After putting some thought into this, the seamless monkey-patching of Backbone.Model does seem like an unnecessary risk. I'm going to move everything into the Backbone.Validations.Model and make it only accept an object.
I'll make a version 0.1 tag for the current release and mark the new API as 0.2.