Skip to content

New DSL to define validations + Numericality

Compare
Choose a tag to compare
@esbanarango esbanarango released this 15 May 13:08
· 776 commits to master since this release

Before:

validations: {
  presence: ['name','email'],
  email: ['email'],
  relations: {
    hasMany:['otherFakes']
  }
}

Now:

  validations: {
    name: {
      presence: true
    },
    email: {
      presence: true,
      email: true
    },
    lotteryNumber: {
      numericality: true
    },
    otherFakes:{
      relations: ['hasMany']
    }
  }