Skip to content

Commit af09d6b

Browse files
authored
Merge pull request rails#46417 from spuyet/fix/activemodel-doc-error[ci-skip]
Fix active model errors add documentation
2 parents cdd4170 + 5e3b9f2 commit af09d6b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

activemodel/lib/active_model/errors.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def group_by_attribute
287287
# person.errors.messages
288288
# # => {:name=>["can't be blank"]}
289289
#
290-
# person.errors.add(:name, :too_long, { count: 25 })
290+
# person.errors.add(:name, :too_long, count: 25)
291291
# person.errors.messages
292292
# # => ["is too long (maximum is 25 characters)"]
293293
#
@@ -338,7 +338,7 @@ def add(attribute, type = :invalid, **options)
338338
# If the error requires options, then it returns +true+ with
339339
# the correct options, or +false+ with incorrect or missing options.
340340
#
341-
# person.errors.add :name, :too_long, { count: 25 }
341+
# person.errors.add :name, :too_long, count: 25
342342
# person.errors.added? :name, :too_long, count: 25 # => true
343343
# person.errors.added? :name, "is too long (maximum is 25 characters)" # => true
344344
# person.errors.added? :name, :too_long, count: 24 # => false
@@ -360,7 +360,7 @@ def added?(attribute, type = :invalid, options = {})
360360
# present, or +false+ otherwise. +type+ is treated the same as for +add+.
361361
#
362362
# person.errors.add :age
363-
# person.errors.add :name, :too_long, { count: 25 }
363+
# person.errors.add :name, :too_long, count: 25
364364
# person.errors.of_kind? :age # => true
365365
# person.errors.of_kind? :name # => false
366366
# person.errors.of_kind? :name, :too_long # => true

0 commit comments

Comments
 (0)