Class: DelayValidator

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

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object


178
179
180
181
182
# File 'lib/delay.rb', line 178

def validate_each(record, attribute, value)
  Delay.new(value)
rescue InvalidDelayExpression
  record.errors.add(attribute, method(:bad_delay_message).to_proc, options.merge(value: value))
end