mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix inaccurate docs in active_model errors [ci skip]
The default value for the argument `message` in
`ActiveModel::Errors#add` has a new behavior
since ca99ab2481
.
Before
person.errors.add(:name, nil)
# => ["is invalid"]
After
person.errors.add(:name, nil)
# => [nil]
This commit is contained in:
parent
a407bb245b
commit
ebaf4e40cd
1 changed files with 2 additions and 2 deletions
|
@ -283,9 +283,9 @@ module ActiveModel
|
|||
# ActiveModel::StrictValidationFailed instead of adding the error.
|
||||
# <tt>:strict</tt> option can also be set to any other exception.
|
||||
#
|
||||
# person.errors.add(:name, nil, strict: true)
|
||||
# person.errors.add(:name, :invalid, strict: true)
|
||||
# # => ActiveModel::StrictValidationFailed: name is invalid
|
||||
# person.errors.add(:name, nil, strict: NameIsInvalid)
|
||||
# person.errors.add(:name, :invalid, strict: NameIsInvalid)
|
||||
# # => NameIsInvalid: name is invalid
|
||||
#
|
||||
# person.errors.messages # => {}
|
||||
|
|
Loading…
Reference in a new issue