fantactuka/backbone-validator — pull request #23 by ragulka (2014-04-10 17:45:51+00:00)
Title: Add model validator and improve collection validator

This PR brings quite a few improvements (all backwards-compatible).

1. Do not try to validate collection (or model) if value is falsy, as reported in #21
2. Allow specifying Collection constructor, as discussed in #22
3. Introduce a model validator, which works pretty much the same as collection validator, expect for models.
```javascript
var Comment = Backbone.Model.extend({
validation: {
user: {
model: User
}
}
});
```

The last 2 are pretty powerful features. The good thing is - they do not affect the codebase a lot - just a few lines of code, but a lot of flexibility.

I have also provided the tests for all of the above cases.