Class: ArrayValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- ArrayValidator
- Defined in:
- lib/array_validator.rb
Instance Attribute Summary collapse
-
#attrib ⇒ Object
readonly
Returns the value of attribute attrib.
Instance Method Summary collapse
Instance Attribute Details
#attrib ⇒ Object (readonly)
Returns the value of attribute attrib.
4 5 6 |
# File 'lib/array_validator.rb', line 4 def attrib @attrib end |
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
6 7 8 9 |
# File 'lib/array_validator.rb', line 6 def validate_each(record, attribute, value) @attrib = attribute record.errors[attribute] << "must be in: #{show_list}" unless contains? value end |