Class: Balloon::Validate::DownloadValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/balloon/validate.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attr_name, value) ⇒ Object



13
14
15
16
17
18
# File 'lib/balloon/validate.rb', line 13

def validate_each(record, attr_name, value)
  if e = record.send(:download_error)
    message = (e.message == e.class.to_s) ? :download_error : e.message
    record.errors.add(attr_name, message)
  end
end