documentcloud/backbone — Issue #1063: Misleading documentation for "validate" method
Author: szimek
Created: 2012-03-02 14:39:00+00:00
State: open

The docs for `validate` method state that:

>validate is called before set and save, and is passed the attributes that are about to be updated

In my understanding it means that attributres passed to `set` or `save` will passed to `validate`. However, it looks like actually *all* attributes are passed there. E.g. `set` passes attributes to be updated to `_validate` method, but inside it there's the [following code](https://github.com/documentcloud/backbone/blob/master/backbone.js#L491-492):

``` javascript
attrs = _.extend({}, this.attributes, attrs);
var error = this.validate(attrs, options);
```

that merges attributes that are about to be updated with all attributes of a model.