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



12
13
14
# File 'lib/sequent/core/helpers/date_validator.rb', line 12

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