diff options
author | Edouard CHIN <edouard.chin@shopify.com> | 2019-07-11 01:41:14 +0200 |
---|---|---|
committer | Edouard CHIN <edouard.chin@shopify.com> | 2019-07-11 01:41:14 +0200 |
commit | 4a8cf101485469194f56ff666b262bd8bb2a538e (patch) | |
tree | 32c48f9baf14c68e6a4add2e5a445eb86d358924 /activemodel/lib | |
parent | 84ff4f6ea2a118b47160e3fe7ed29bff52c2a7a2 (diff) | |
download | rails-4a8cf101485469194f56ff666b262bd8bb2a538e.tar.gz rails-4a8cf101485469194f56ff666b262bd8bb2a538e.tar.bz2 rails-4a8cf101485469194f56ff666b262bd8bb2a538e.zip |
Returns `nil` when `AM::Errors#delete` doesn't delete anything:
- `AM::Errors#delete` currently returns an empty array when trying
to delete an error that doesn't exist.
This behaviour is surprising and I think it would be better
to no return a truthy value but instead return nil like
`Hash#delete` does.
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index f8ea21cf47..f6d6e64a25 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -199,7 +199,7 @@ module ActiveModel matches.each do |error| @errors.delete(error) end - matches.map(&:message) + matches.map(&:message).presence end # When passed a symbol or a name of a method, returns an array of errors |