Class: Medivo::ArrayValidator
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- Medivo::ArrayValidator
- Defined in:
- lib/support/validators.rb
Instance Method Summary collapse
Instance Method Details
#validate(record) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/support/validators.rb', line 3 def validate(record) for field in [:fields] value = record.attributes[field] record.errors.add(field, "#{field} must be an array") unless value.is_a? Array end end |