Put model errors alongside field errors by validation name

Bart Nagel
2013-05-23T22:57:31-07:00

Instead of a hash called __model with the model validation errors, the
model validation errors are now alongside the field validation keys of
the hash, named after the validation's key in the validate array. To be
as consistent as possible, the value is an array even though it will
only ever have one member. The structure is set to change in 2.0.

Example: where there was a model validation set up like

validate: {
xnor: function() {
if (this.field1 === null) === (this.field2 === null) {
throw new Error('require both or neither')
}
}
}

and field1 and field2 have some validations, validate() might return
something like

{
field1: [
'must be an email address',
'email address must be @example.com'
],
xnor: ['require both or neither']
}