aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-04-07 02:03:24 -0400
committerGitHub <noreply@github.com>2017-04-07 02:03:24 -0400
commit8547d9fe266f04e47b1a831d6f5836b354c9be02 (patch)
tree0fd72cff54086dfceffe2032cadfbb8f1dce9d7c /activemodel/lib
parent5f08a230340934da2899cb5e2043952aa6bc59ae (diff)
parent23547c8c208d5405e04056ae8bfd726961983e54 (diff)
downloadrails-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')
-rw-r--r--activemodel/lib/active_model/errors.rb8
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