lib/base/validations.js
function() {
    var self = this
    var validations = []

    return self
      .callInterceptors('beforeValidation', [self])
      .then(function() {
        for (var field in self.definition.validations) {
          var fieldValidations = self.definition.validations[field]

          // set the scope of all validator function to the current record
          for (var i in fieldValidations) {
            validations.push(fieldValidations[i].bind(self))
          }
        }
        return self.store.utils.parallel(validations)
      })
      .then(function(result) {
        if (self.errors.has) throw self.errors
      })
      .then(function() {
        return self.callInterceptors('afterValidation', [self])
      })
      .then(function() {
        return self
      })
  }
function() {
    var self = this
    var validations = []

    return self
      .callInterceptors('beforeValidation', [self])
      .then(function() {
        for (var field in self.definition.validations) {
          var fieldValidations = self.definition.validations[field]

          // set the scope of all validator function to the current record
          for (var i in fieldValidations) {
            validations.push(fieldValidations[i].bind(self))
          }
        }
        return self.store.utils.parallel(validations)
      })
      .then(function(result) {
        if (self.errors.has) throw self.errors
      })
      .then(function() {
        return self.callInterceptors('afterValidation', [self])
      })
      .then(function() {
        return self
      })
  }
function ( ) { var self = this var validations = [ ] return self . callInterceptors ( 'beforeValidation' , [ self ] ) . then ( function ( ) { for ( var field in self . definition . validations ) { var fieldValidations = self . definition . validations [ field ] // set the scope of all validator function to the current record for ( var i in fieldValidations ) { validations . push ( fieldValidations [ i ] . bind ( self ) ) } } return self . store . utils . parallel ( validations ) } ) . then ( function ( result ) { if ( self . errors . has ) throw self . errors } ) . then ( function ( ) { return self . callInterceptors ( 'afterValidation' , [ self ] ) } ) . then ( function ( ) { return self } ) }
validates the record

@class Record
@method validate

@this Promise
validates the record