提交 629bc03b 编写于 作者: F Francesco Rodriguez

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
上级 35ee8fa3
......@@ -87,8 +87,8 @@ def clear
end
# Do the error messages include an error with key +error+?
def include?(error)
(v = messages[error]) && v.any?
def include?(attribute)
(v = messages[attribute]) && v.any?
end
alias :has_key? :include?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册