class ActiveModel::Errors
def added?(attribute, message = :invalid, options = {})
person.errors.added? :name, :too_long # => false
person.errors.added? :name, :too_long, count: 24 # => false
person.errors.added? :name, "is too long (maximum is 25 characters)" # => true
person.errors.added? :name, :too_long, count: 25 # => true
person.errors.add :name, :too_long, { count: 25 }
the correct option, or +false+ with an incorrect or missing option.
If the error message requires an option, then it returns +true+ with
person.errors.added? :name, "can't be blank" # => true
person.errors.added? :name, :blank # => true
person.errors.add :name, :blank
present, or +false+ otherwise. +message+ is treated the same as for +add+.
Returns +true+ if an error on the attribute with the given message is
def added?(attribute, message = :invalid, options = {}) message = message.call if message.respond_to?(:call) message = normalize_message(attribute, message, options) self[attribute].include? message end