From fdbc55b9d55ae9d2b5b39be3ef4af5f60f6954a3 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Mon, 22 Jun 2020 21:19:21 +0900 Subject: [PATCH] Use Array(ActiveSupport::ToJsonWithActiveSupportEncoder)#to_json and Hash(ActiveSupport::ToJsonWithActiveSupportEncoder)#to_json for Ruby 2.8.0 This pull request addresses failures at https://buildkite.com/rails/rails/builds/70219#79d96882-6c51-4854-8cab-28f50ac8bca1 According to https://bugs.ruby-lang.org/issues/16973 This is an expected change in Ruby. These failures has been addressed by changing the order of prepend as suggested. Refer https://github.com/ruby/ruby/pull/3181 https://github.com/ruby/ruby/pull/2936 https://bugs.ruby-lang.org/issues/9573 https://github.com/rails/rails/pull/19413 --- activesupport/lib/active_support/core_ext/object/json.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/core_ext/object/json.rb b/activesupport/lib/active_support/core_ext/object/json.rb index d92af19137cd..dcfbe8b40f2a 100644 --- a/activesupport/lib/active_support/core_ext/object/json.rb +++ b/activesupport/lib/active_support/core_ext/object/json.rb @@ -45,7 +45,7 @@ def to_json(options = nil) end end -[Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass, Enumerable].reverse_each do |klass| +[Enumerable, Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass].reverse_each do |klass| klass.prepend(ActiveSupport::ToJsonWithActiveSupportEncoder) end