mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-25 15:22:58 +00:00
custom error message options
This commit is contained in:
26
README.rdoc
26
README.rdoc
@@ -90,6 +90,17 @@ Regular validation options:
|
||||
:if - Execute validation when :if evaluates true
|
||||
:unless - Execute validation when :unless evaluates false
|
||||
|
||||
The temporal restrictions can take 4 different value types:
|
||||
|
||||
* String value
|
||||
* Date, Time, or DateTime object value
|
||||
* Proc or lambda object which may take an optional parameter, being the record object
|
||||
* A symbol matching a method name in the model
|
||||
|
||||
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
|
||||
values are compared as dates.
|
||||
|
||||
|
||||
== Configuration
|
||||
|
||||
@@ -111,6 +122,21 @@ Using the I18n system to define new defaults:
|
||||
|
||||
The %{restriction} signifies where the interpolation value for the restriction will be inserted.
|
||||
|
||||
You can also use validation options for custom error messages. The following option keys are available:
|
||||
|
||||
:invalid_date_message
|
||||
:invalid_time_message
|
||||
:invalid_datetime_message
|
||||
:is_at_message
|
||||
:before_message
|
||||
:on_or_before_message
|
||||
:after_message
|
||||
:on_or_after_message
|
||||
|
||||
* There is no :between_message option. The between error message should be defined using the :on_or_before and :on_or_after messages.
|
||||
|
||||
However, it is highly recommended you use the I18n system for error messages.
|
||||
|
||||
|
||||
=== Restriction Option Shorthand
|
||||
|
||||
|
||||
Reference in New Issue
Block a user