Class: Sequent::Core::Helpers::DateValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/sequent/core/helpers/date_validator.rb

Overview

Validates Dates Automatically included when using a

attrs value: Date

Instance Method Summary collapse

Instance Method Details

#validate_each(subject, attribute, value) ⇒ Object



14
15
16
17
18
19
# File 'lib/sequent/core/helpers/date_validator.rb', line 14

def validate_each(subject, attribute, value)
  unless Sequent::Core::Helpers::ValueValidators.for(Date).valid_value?(value)
    subject.errors.add attribute,
                       :invalid_date
  end
end