rails validate uniqueness
validates :email, uniqueness: true
rails validate uniqueness
validates :email, uniqueness: true
rails validators
validates :name, length: { minimum: 2 } # or { maximum: 500 } or { in: 6..20 } or { is: 6 }
validates :name, :login, :email, presence: true
validates :email, uniqueness: true
validates :switch, inclusion: { in: [true, false] }
validates :terms_of_service, acceptance: true
validates :size, inclusion: { in: %w(small medium large), message: "%{value} is not a valid size" }
validates :legacy_code, format: { with: /\A[a-zA-Z]+\z/, message: "only allows letters" }
validates inclusion of rails
validates_inclusion_of :size, :in => ['small', 'medium', 'large']
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us