instance method
get
Ruby on Rails 5.0.7.2
Last seen in v5.0.7.2Signature
get(key)
Get messages for key.
person.errors.messages # => {:name=>["cannot be nil"]}
person.errors.get(:name) # => ["cannot be nil"]
person.errors.get(:age) # => []
Parameters
-
keyreq
Source
# File activemodel/lib/active_model/errors.rb, line 123
def get(key)
ActiveSupport::Deprecation.warn(<<-MESSAGE.squish)
ActiveModel::Errors#get is deprecated and will be removed in Rails 5.1.
To achieve the same use model.errors[:#{key}].
MESSAGE
messages[key]
end
Defined in activemodel/lib/active_model/errors.rb line 123
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Errors