instance method
added?
Ruby on Rails 3.2.22.5
Since v3.2.22.5Signature
added?(attribute, message = nil, options = {})
Returns true if an error on the attribute with the given message is present, false otherwise. message is treated the same as for add.
p.errors.add :name, :blank p.errors.added? :name, :blank # => true
Parameters
-
attributereq -
messageopt = nil -
optionsopt = {}
Source
# File activemodel/lib/active_model/errors.rb, line 262
def added?(attribute, message = nil, options = {})
message = normalize_message(attribute, message, options)
self[attribute].include? message
end
Defined in activemodel/lib/active_model/errors.rb line 262
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Errors