Class: DateValueValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- DateValueValidator
- Defined in:
- lib/date_values/rails/date_value_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/date_values/rails/date_value_validator.rb', line 6 def validate_each(record, attribute, value) raw = record.read_attribute_before_type_cast(attribute) return if raw.blank? return unless value.nil? record.errors.add(attribute, :invalid, **) end |