added between option details to README

This commit is contained in:
Adam Meehan 2009-01-01 20:28:02 +11:00
parent a71d6f7945
commit a14bc306b3

View File

@ -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 :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 :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 :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: Regular validation options:
:allow_nil - Allow a nil value to be valid :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 :on_or_before_message
:after_message :after_message
:on_or_after_message :on_or_after_message
:between_message
The temporal restrictions can take 4 different value types: 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 * Date, Time, or DateTime object value
* Proc or lambda object * Proc or lambda object
* A symbol matching the method name in the model * 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 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 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", :before => "must be before %s",
:on_or_before => "must be on or before %s", :on_or_before => "must be on or before %s",
:after => "must be after %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. 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: messages:
on_or_before: "must be equal to or before {{restriction}}" on_or_before: "must be equal to or before {{restriction}}"
on_or_after: "must be equal to or after {{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 The {{restriction}} signifies where the interpolation value for the restriction
will be inserted. will be inserted.