mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-23 06:16:44 +00:00
expand example
This commit is contained in:
parent
82ede60985
commit
712c1dd603
@ -56,14 +56,14 @@ To validate a model with a date, time or datetime attribute you just use the
|
|||||||
validation method
|
validation method
|
||||||
|
|
||||||
class Person < ActiveRecord::Base
|
class Person < ActiveRecord::Base
|
||||||
validates_date :date_of_birth
|
validates_date :date_of_birth, :on_or_before => lambda { Date.today }
|
||||||
# or
|
# or
|
||||||
validates :date_of_birth, :timeliness => {:type => date}
|
validates :date_of_birth, :timeliness => {:on_or_before => lambda { Date.today }, :type => date}
|
||||||
end
|
end
|
||||||
|
|
||||||
# or even on a specific record, per ActiveModel API.
|
# or even on a specific record, per ActiveModel API.
|
||||||
|
|
||||||
@person.validates_date :date_of_birth
|
@person.validates_date :date_of_birth, :on_or_before => lambda { Date.today }
|
||||||
|
|
||||||
|
|
||||||
The list of validation methods available are as follows:
|
The list of validation methods available are as follows:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user