Skip to content

Commit d22c657

Browse files
Merge pull request rails#50206 from orhantoy/document-errors-delegated-methods
Document delegated methods in `ActiveModel::Errors` [ci skip]
2 parents 87c42b2 + d86b098 commit d22c657

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

activemodel/lib/active_model/errors.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class Errors
6363

6464
extend Forwardable
6565

66+
##
6667
# :method: each
6768
#
6869
# :call-seq: each(&block)
@@ -74,6 +75,31 @@ class Errors
7475
# # Will yield <#ActiveModel::Error attribute=name, type=too_short,
7576
# options={:count=>3}>
7677
# end
78+
79+
##
80+
# :method: clear
81+
#
82+
# :call-seq: clear
83+
#
84+
# Clears all errors. Clearing the errors does not, however, make the model
85+
# valid. The next time the validations are run (for example, via
86+
# ActiveRecord::Validations#valid?), the errors collection will be filled
87+
# again if any validations fail.
88+
89+
##
90+
# :method: empty?
91+
#
92+
# :call-seq: empty?
93+
#
94+
# Returns true if there are no errors.
95+
96+
##
97+
# :method: size
98+
#
99+
# :call-seq: size
100+
#
101+
# Returns number of errors.
102+
77103
def_delegators :@errors, :each, :clear, :empty?, :size, :uniq!
78104

79105
# The actual array of +Error+ objects

0 commit comments

Comments
 (0)