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



48
49
50
51
52
53
54
# File 'lib/atdis/validators.rb', line 48

def validate_each(record, attribute, value)
  if value && !value.kind_of?(Array)
    message = "should be an array"
    message = ErrorMessage[message, options[:spec_section]] if options[:spec_section]
    record.errors.add(attribute, message)
  end
end