Class: ATDIS::Validators::ArrayValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/atdis/validators.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



51
52
53
54
55
56
57
# File 'lib/atdis/validators.rb', line 51

def validate_each(record, attribute, value)
  return unless value && !value.is_a?(Array)

  message = "should be an array"
  message = ErrorMessage[message, options[:spec_section]] if options[:spec_section]
  record.errors.add(attribute, message)
end