aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorEdouard CHIN <edouard.chin@shopify.com>2019-07-22 14:02:15 +0200
committerEdouard CHIN <edouard.chin@shopify.com>2019-07-23 14:11:36 +0200
commit35ac22d6ef60bcfb699ed6e92d9cbe4d891762c3 (patch)
treed61ad81651d0149e54b71e030b096602d32a1ab4 /activemodel/lib
parent9ad806887096be1f60019a6b301a4c84aa1d8e65 (diff)
downloadrails-35ac22d6ef60bcfb699ed6e92d9cbe4d891762c3.tar.gz
rails-35ac22d6ef60bcfb699ed6e92d9cbe4d891762c3.tar.bz2
rails-35ac22d6ef60bcfb699ed6e92d9cbe4d891762c3.zip
Deprecated `AM::Errors#to_h`:
- In ef4d3215b1198c456780b8d18aa62be7795b9b8c I made a change to pass `AM::Error` object in case the arity of the block passed to `each` accepted less than 2 arguments. This is causing one issue for `to_h` as it expects the argument passed to the block to be an Array (and were are passing it an instance of `AM::Error`). There is no real reason to use `to_h` anymore since `to_hash` exists Deprecating `to_h` inf favor of `to_hash` Co-Authored-By: Rafael França <rafael@franca.dev>
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/errors.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb
index 5628a59845..e7405fb586 100644
--- a/activemodel/lib/active_model/errors.rb
+++ b/activemodel/lib/active_model/errors.rb
@@ -303,6 +303,12 @@ module ActiveModel
hash
end
+ def to_h
+ deprecation_rename_warning(:to_h, :to_hash)
+
+ to_hash
+ end
+
def messages
DeprecationHandlingMessageHash.new(self)
end