diff options
author | Mehmet Emin İNAÇ <mehmetemininac@gmail.com> | 2016-02-04 20:03:24 +0200 |
---|---|---|
committer | Mehmet Emin İNAÇ <mehmetemininac@gmail.com> | 2016-02-04 20:03:24 +0200 |
commit | e38ced376fc4f67036d44bd905fb03dcc12782f7 (patch) | |
tree | a04cbaf0583e085eb98081e1ec3fc5fe96a4ab3a /activemodel/lib | |
parent | e22404a8b2f258ca657fc54f0f3700b75db0c05b (diff) | |
download | rails-e38ced376fc4f67036d44bd905fb03dcc12782f7.tar.gz rails-e38ced376fc4f67036d44bd905fb03dcc12782f7.tar.bz2 rails-e38ced376fc4f67036d44bd905fb03dcc12782f7.zip |
Add documentation about method to describe how it works [ci skip]
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index ef6141a51d..ea69e7549e 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -160,6 +160,15 @@ module ActiveModel # # person.errors[:name] # => ["cannot be nil"] # person.errors['name'] # => ["cannot be nil"] + # + # Note that, if you try to get errors of an attribute which has + # no errors associated with it, this method will instantiate + # an empty error list for it and +keys+ will return an array + # of error keys which includes this attribute. + # + # person.errors.keys # => [] + # person.errors[:name] # => [] + # person.errors.keys # => [:name] def [](attribute) messages[attribute.to_sym] end |