method

validate_each

validate_each(record, attribute, value)
public

No documentation available.

# File activemodel/lib/active_model/validations/inclusion.rb, line 11
      def validate_each(record, attribute, value)
        unless options[:in].include?(value)
          record.errors.add(attribute, :inclusion, options.except(:in).merge!(:value => value))
        end
      end

1Note

No way to use custom message

nhance ยท Jul 5, 2011

In what appears to be a bug, there appears to be no way to use a custom error message when using this validator.