instance method
include?
Ruby on Rails 4.0.13
Since v3.1.12Signature
include?(attribute)
Returns true if the error messages include an error for the given key attribute, false otherwise.
person.errors.messages # => {:name=>["can not be nil"]} person.errors.include?(:name) # => true person.errors.include?(:age) # => false
Parameters
-
attributereq
Source
# File activemodel/lib/active_model/errors.rb, line 95
def include?(attribute)
(v = messages[attribute]) && v.any?
end
Defined in activemodel/lib/active_model/errors.rb line 95
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Errors