[ci skip] Expand information on message options

Link to the more detailed message documentation when using a message option in validations.
This commit is contained in:
schneems 2016-06-07 10:35:54 -05:00
parent 3fc5577363
commit 05b7c415c8

@ -392,7 +392,8 @@ The `exclusion` helper has an option `:in` that receives the set of values that
will not be accepted for the validated attributes. The `:in` option has an
alias called `:within` that you can use for the same purpose, if you'd like to.
This example uses the `:message` option to show how you can include the
attribute's value.
attribute's value. For full options to the message argument please see the
[message documentation](#message).
The default error message is _"is reserved"_.
@ -427,7 +428,8 @@ end
The `inclusion` helper has an option `:in` that receives the set of values that
will be accepted. The `:in` option has an alias called `:within` that you can
use for the same purpose, if you'd like to. The previous example uses the
`:message` option to show how you can include the attribute's value.
`:message` option to show how you can include the attribute's value. For full
options please see the [message documentation](#message).
The default error message for this helper is _"is not included in the list"_.
@ -768,6 +770,9 @@ class Coffee < ApplicationRecord
end
```
For full options to the message argument please see the
[message documentation](#message).
### `:allow_blank`
The `:allow_blank` option is similar to the `:allow_nil` option. This option
@ -792,7 +797,8 @@ for each validation helper. The `:message` option accepts a `String` or `Proc`.
A `String` `:message` value can optionally contain any/all of `%{value}`,
`%{attribute}`, and `%{model}` which will be dynamically replaced when
validation fails.
validation fails. This replacement is done using the I18n gem, and the
placeholders must match exactly, no spaces are allowed.
A `Proc` `:message` value is given two arguments: the object being validated, and
a hash with `:model`, `:attribute`, and `:value` key-value pairs.