aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorEdouard CHIN <edouard.chin@shopify.com>2019-07-11 01:41:14 +0200
committerEdouard CHIN <edouard.chin@shopify.com>2019-07-11 01:41:14 +0200
commit4a8cf101485469194f56ff666b262bd8bb2a538e (patch)
tree32c48f9baf14c68e6a4add2e5a445eb86d358924 /activemodel/lib
parent84ff4f6ea2a118b47160e3fe7ed29bff52c2a7a2 (diff)
downloadrails-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.rb2
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