Class: FutureValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/trax/validators/future_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(object, attribute, value) ⇒ Object



2
3
4
# File 'lib/trax/validators/future_validator.rb', line 2

def validate_each(object, attribute, value)
  object.errors[attribute] << 'Must be in future' if value && (value < ::DateTime.now)
end