Merge pull request #50206 from orhantoy/document-errors-delegated-methods

Document delegated methods in `ActiveModel::Errors` [ci skip]
This commit is contained in:
Jonathan Hefner 2023-11-29 10:12:37 -06:00 committed by GitHub
commit d22c6576b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions

View File

@ -63,6 +63,7 @@ module ActiveModel
extend Forwardable
##
# :method: each
#
# :call-seq: each(&block)
@ -74,6 +75,31 @@ module ActiveModel
# # Will yield <#ActiveModel::Error attribute=name, type=too_short,
# options={:count=>3}>
# end
##
# :method: clear
#
# :call-seq: clear
#
# Clears all errors. Clearing the errors does not, however, make the model
# valid. The next time the validations are run (for example, via
# ActiveRecord::Validations#valid?), the errors collection will be filled
# again if any validations fail.
##
# :method: empty?
#
# :call-seq: empty?
#
# Returns true if there are no errors.
##
# :method: size
#
# :call-seq: size
#
# Returns number of errors.
def_delegators :@errors, :each, :clear, :empty?, :size, :uniq!
# The actual array of +Error+ objects