module ActiveModel::Validations::HelperMethods
Public Instance Methods
validates_date_of(*attr_names)
click to toggle source
Validates whether the value of the specified attribute is a validate Date
class Person < ActiveRecord::Base validates_date_of :payment_date, after: :packaging_date validates_date_of :expiration_date, before: Proc.new { Time.now } end
Configuration options:
-
:after
- check that a Date is after the specified one. -
:before
- check that a Date is before the specified one. -
:after_or_equal_to
- check that a Date is after or equal to the specified one. -
:before_or_equal_to
- check that a Date is before or equal to the specified one. -
:equal_to
- check that a Date is equal to the specified one.
# File lib/active_model/validations/date_validator.rb, line 126 def validates_date_of(*attr_names) validates_with DateValidator, _merge_attributes(attr_names) end