n-time/backbone.validations — Issue #9: `validate` method doesn't conform to Backbone API
Author: dcuddeback
Created: 2011-12-18 01:48:49+00:00
State: open

With Backbone.js (before installing Backbone.Validations), the `validate` method expects a hash of attributes. It seems that after installing Backbone.Validations, the `validate` method expects the model object.

Without `Backbone.Validations`:

var post = new Post;
post.validate({title : "Foo"});

With `Backbone.Validations`, the above call will throw a `TypeError`. Instead, I have to pass `post` to `validate`:

var post = new Post;
post.validate(post);

The documentation for Backbone says that it will pass the attributes to `validate`. Being able to pass attributes directly to `validate` will be useful when validating an attribute while the user types. http://documentcloud.github.com/backbone/#Model-validate