Check out example codes for "validates inclusion of rails". It will help you in understanding the concepts better.

Code Example 1

validates_inclusion_of :size, :in => ['small', 'medium', 'large']

Code Example 2

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" }

Learn ReactJs, React Native from akashmittal.com