Class: TypedEAV::Field::Date
- Inherits:
-
Base
- Object
- ActiveRecord::Base
- ApplicationRecord
- Base
- TypedEAV::Field::Date
- Defined in:
- app/models/typed_eav/field/date.rb
Constant Summary
Constants inherited from Base
Constants included from ColumnMapping
ColumnMapping::DEFAULT_OPERATORS_BY_COLUMN, ColumnMapping::FALLBACK_OPERATORS
Instance Method Summary collapse
Methods inherited from Base
#allowed_option_values, #array_field?, #clear_option_cache!, #default_value, #default_value=, #field_type_name, #optionable?
Instance Method Details
#cast(raw) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/models/typed_eav/field/date.rb', line 10 def cast(raw) return [nil, false] if raw.nil? casted = raw.is_a?(::Date) ? raw : ::Date.parse(raw.to_s) [casted, false] rescue ::Date::Error [nil, true] end |
#validate_typed_value(record, val) ⇒ Object
19 20 21 |
# File 'app/models/typed_eav/field/date.rb', line 19 def validate_typed_value(record, val) validate_date_range(record, val) end |