Class: Braspag::Billet::DueDateValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/cbraspag/payment/billet.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/cbraspag/payment/billet.rb', line 21

def validate_each(record, attribute, value)
  # unless value.class.in? [Date, Time]
  unless (
    value.kind_of?(Time) || value.kind_of?(Date)
  )
    record.errors.add attribute, "invalid date"
  end
end