Skip to content

Commit

Permalink
Adding options example in ActiveModel::Errors doc
Browse files Browse the repository at this point in the history
Place errors with variable example under the `type is a symbol` block
Closes #41124
  • Loading branch information
Vin0uz committed Feb 3, 2021
1 parent af9c910 commit da0e869
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions activemodel/lib/active_model/errors.rb
Expand Up @@ -378,6 +378,14 @@ def group_by_attribute
# If +type+ is a symbol, it will be translated using the appropriate
# scope (see +generate_message+).
#
# person.errors.add(:name, :blank)
# person.errors.messages
# # => {:name=>["can't be blank"]}
#
# person.errors.add(:name, :too_long, { count: 25 })
# person.errors.messages
# # => ["is too long (maximum is 25 characters)"]
#
# If +type+ is a proc, it will be called, allowing for things like
# <tt>Time.now</tt> to be used within an error.
#
Expand Down

0 comments on commit da0e869

Please sign in to comment.