validates_inclusion_of(*attr_names)
Instance Public methods
Validates whether the value of the specified attribute is available in a
particular enumerable object.
class Person < ActiveRecord::Base
validates_inclusion_of :gender, in: %w( m f )
validates_inclusion_of :age, in: 0..99
validates_inclusion_of :format, in: %w( jpg gif png ), message: "extension %{value} is not included in the list"
validates_inclusion_of :states, in: ->(person) { STATES[person.country] }
v