Class: Sequent::Core::Helpers::TimeValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Sequent::Core::Helpers::TimeValidator
- Defined in:
- lib/sequent/core/helpers/time_validator.rb
Overview
Validates Time Automatically included when using a
attrs value: Time
Instance Method Summary collapse
Instance Method Details
#validate_each(subject, attribute, value) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/sequent/core/helpers/time_validator.rb', line 13 def validate_each(subject, attribute, value) return if value.is_a?(Time) Time.deserialize_from_json(value) rescue StandardError subject.errors.add attribute, :invalid_time end |