emberjs/data — pull request #130 by juggy (2012-02-29 19:53:05+00:00)
Title: Client side validations

Hello,

Here is an implementation of client side validations. You can define a validate method on your model

```
var Person = DS.Model.extend({
name: DS.attr('string'),
foo: DS.attr('string'),
validate: function(){
this.addError('name', 'always invalid!');
}
});
```
Or you can specify validations on each fields:

```
var Person = DS.Model.extend({
name: DS.attr('string', {validations:{presence:true}}),
foo: DS.attr('string', {validations:{custom:{arg1:123, arg2:456}}),
custom: function(key, options){
// options are the args from the custom validation declaration.
}
});
```

Right now the only bundled validation is 'presence' .

Thanks,
Julien.