diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-04-01 15:52:11 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-04-01 15:52:11 +0900 |
commit | 23547c8c208d5405e04056ae8bfd726961983e54 (patch) | |
tree | 52b5fa500c539430fcf40340b6b181d0330e5157 /activemodel/lib/active_model | |
parent | 56014880a2d25416befbd2e440fc94c2b66a0026 (diff) | |
download | rails-23547c8c208d5405e04056ae8bfd726961983e54.tar.gz rails-23547c8c208d5405e04056ae8bfd726961983e54.tar.bz2 rails-23547c8c208d5405e04056ae8bfd726961983e54.zip |
Fix `warning: extra states are no longer copied`
`messages` has `default_proc` so calling `reject` causes the warning.
https://github.com/ruby/ruby/blob/v2_4_1/hash.c#L1335-L1337
Diffstat (limited to 'activemodel/lib/active_model')
-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 |