Class: Rearview::CronExpressionValidator

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

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/rearview/cron_expression_validator.rb', line 3

def validate_each(record, attribute, value)
  if value.present?
    unless Rearview::CronHelper.valid_expression?(value)
      record.errors.add(attribute,(options[:message] || "is not a valid cron expression"))
    end
  end
end