mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-23 06:16:44 +00:00
added between option details to README
This commit is contained in:
parent
a71d6f7945
commit
a14bc306b3
@ -64,6 +64,7 @@ the valid range of dates or times allowed
|
||||
:on_or_before - Attribute must be equal to or before this value to be valid
|
||||
:after - Attribute must be after this value to be valid
|
||||
:on_or_after - Attribute must be equal to or after this value to be valid
|
||||
:between - Attribute must be between the values to be valid
|
||||
|
||||
Regular validation options:
|
||||
:allow_nil - Allow a nil value to be valid
|
||||
@ -79,6 +80,7 @@ the valid range of dates or times allowed
|
||||
:on_or_before_message
|
||||
:after_message
|
||||
:on_or_after_message
|
||||
:between_message
|
||||
|
||||
The temporal restrictions can take 4 different value types:
|
||||
|
||||
@ -86,6 +88,7 @@ The temporal restrictions can take 4 different value types:
|
||||
* Date, Time, or DateTime object value
|
||||
* Proc or lambda object
|
||||
* A symbol matching the method name in the model
|
||||
* Between option takes an array of two values or a range
|
||||
|
||||
When an attribute value is compared to temporal restrictions, they are compared as
|
||||
the same type as the validation method type. So using validates_date means all
|
||||
@ -266,7 +269,8 @@ For Rails 2.0/2.1:
|
||||
:before => "must be before %s",
|
||||
:on_or_before => "must be on or before %s",
|
||||
:after => "must be after %s",
|
||||
:on_or_after => "must be on or after %s"
|
||||
:on_or_after => "must be on or after %s",
|
||||
:between => "must be between %s and %s"
|
||||
)
|
||||
|
||||
Where %s is the interpolation value for the restriction.
|
||||
@ -279,6 +283,7 @@ Rails 2.2+ using the I18n system to define new defaults:
|
||||
messages:
|
||||
on_or_before: "must be equal to or before {{restriction}}"
|
||||
on_or_after: "must be equal to or after {{restriction}}"
|
||||
between: "must be between {{earliest}} and {{latest}}"
|
||||
|
||||
The {{restriction}} signifies where the interpolation value for the restriction
|
||||
will be inserted.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user