diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-04-07 02:03:24 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-07 02:03:24 -0400 |
commit | 8547d9fe266f04e47b1a831d6f5836b354c9be02 (patch) | |
tree | 0fd72cff54086dfceffe2032cadfbb8f1dce9d7c /activemodel/lib/active_model/errors.rb | |
parent | 5f08a230340934da2899cb5e2043952aa6bc59ae (diff) | |
parent | 23547c8c208d5405e04056ae8bfd726961983e54 (diff) | |
download | rails-8547d9fe266f04e47b1a831d6f5836b354c9be02.tar.gz rails-8547d9fe266f04e47b1a831d6f5836b354c9be02.tar.bz2 rails-8547d9fe266f04e47b1a831d6f5836b354c9be02.zip |
Merge pull request #28632 from kamipo/fix_warning_extra_states_are_no_longer_copied
Fix `warning: extra states are no longer copied`
Diffstat (limited to 'activemodel/lib/active_model/errors.rb')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index 5d3472802b..942b4fa9bb 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -172,8 +172,8 @@ module ActiveModel # person.errors.messages # => {:name=>["cannot be nil", "must be specified"]} # person.errors.values # => [["cannot be nil", "must be specified"]] def values - messages.reject do |key, value| - value.empty? + messages.select do |key, value| + !value.empty? end.values end @@ -182,8 +182,8 @@ module ActiveModel # person.errors.messages # => {:name=>["cannot be nil", "must be specified"]} # person.errors.keys # => [:name] def keys - messages.reject do |key, value| - value.empty? + messages.select do |key, value| + !value.empty? end.keys end |