rails/rails — pull request #6829 by frodsan (2012-06-22 17:50:32+00:00)
Title: change param name to improve documentation

The keys of the error messages are actually attribute names. It makes
the documentation easier to understand:

# Returns +true+ if the error messages include an error for the given
# +attribute+, +false+ otherwise.
#
# person.errors.messages # => { :name => ["can not be nil"] }
# person.errors.include?(:name) # => true
# person.errors.include?(:age) # => false
def include?(attribute)
(v = messages[attribute]) && v.any?
end