From a14bc306b373409c84771380213a478c17713cdb Mon Sep 17 00:00:00 2001 From: Adam Meehan Date: Thu, 1 Jan 2009 20:28:02 +1100 Subject: [PATCH] added between option details to README --- README.rdoc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.rdoc b/README.rdoc index 0f56654..7835778 100644 --- a/README.rdoc +++ b/README.rdoc @@ -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.