Class: ActiveModel::Validations::InclusionValidator
- Inherits:
-
EachValidator
- Object
- ActiveModel::Validator
- EachValidator
- ActiveModel::Validations::InclusionValidator
- Includes:
- Clusivity
- Defined in:
- lib/active_model/validations/inclusion.rb
Overview
:nodoc:
Constant Summary
Constants included from Clusivity
Instance Attribute Summary
Attributes inherited from EachValidator
Attributes inherited from ActiveModel::Validator
Instance Method Summary collapse
Methods included from Clusivity
Methods included from ResolveValue
Methods inherited from EachValidator
#check_validity!, #initialize, #validate
Methods inherited from ActiveModel::Validator
#initialize, kind, #kind, #validate
Constructor Details
This class inherits a constructor from ActiveModel::EachValidator
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
10 11 12 13 14 |
# File 'lib/active_model/validations/inclusion.rb', line 10 def validate_each(record, attribute, value) unless include?(record, value) record.errors.add(attribute, :inclusion, **.except(:in, :within).merge!(value: value)) end end |