Class: Balloon::Validate::ProcessValidator

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



22
23
24
25
26
27
# File 'lib/balloon/validate.rb', line 22

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