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


163
164
165
166
167
# File 'lib/delay.rb', line 163

def validate_each(record, _attribute, value)
  Delay.new(value)
rescue InvalidDelayExpression => e
  record.errors.add(attributes, :invalid, options.merge(value: value))
end