1
0
Fork 0
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:
Robson Marques 2014-12-19 15:26:41 -02:00
parent a407bb245b
commit ebaf4e40cd

View file

@ -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 # => {}