From 0dd76540327be58999b0cb7584277724e60486d3 Mon Sep 17 00:00:00 2001 From: OKURA Masafumi Date: Mon, 22 Mar 2021 21:14:32 +0900 Subject: [PATCH] Remove some references to OrderedHash OrderedHash is deprecated but there are some requires and references to OrderedHash, which might be confusing. As described in https://github.com/rails/rails/issues/22681#issuecomment-166059717 OrderedHash is internal only so references in the docs should be removed. --- activesupport/lib/active_support/core_ext/object/json.rb | 3 +-- activesupport/test/core_ext/hash_ext_test.rb | 1 - activesupport/test/core_ext/object/to_query_test.rb | 1 - activesupport/test/hash_with_indifferent_access_test.rb | 1 - guides/source/active_support_core_extensions.md | 2 +- 5 files changed, 2 insertions(+), 6 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/object/json.rb b/activesupport/lib/active_support/core_ext/object/json.rb index a65e273236..8ba694266d 100644 --- a/activesupport/lib/active_support/core_ext/object/json.rb +++ b/activesupport/lib/active_support/core_ext/object/json.rb @@ -19,8 +19,7 @@ require "active_support/core_ext/date/conversions" # The JSON gem adds a few modules to Ruby core classes containing :to_json definition, overwriting # their default behavior. That said, we need to define the basic to_json method in all of them, # otherwise they will always use to_json gem implementation, which is backwards incompatible in -# several cases (for instance, the JSON implementation for Hash does not work) with inheritance -# and consequently classes as ActiveSupport::OrderedHash cannot be serialized to json. +# several cases (for instance, the JSON implementation for Hash does not work) with inheritance. # # On the other hand, we should avoid conflict with ::JSON.{generate,dump}(obj). Unfortunately, the # JSON gem's encoder relies on its own to_json implementation to encode objects. Since it always diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 3c6263c830..7c2500dd4f 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -4,7 +4,6 @@ require_relative "../abstract_unit" require "active_support/core_ext/hash" require "bigdecimal" require "active_support/core_ext/string/access" -require "active_support/ordered_hash" require "active_support/core_ext/object/conversions" require "active_support/core_ext/date/conversions" require "active_support/core_ext/object/deep_dup" diff --git a/activesupport/test/core_ext/object/to_query_test.rb b/activesupport/test/core_ext/object/to_query_test.rb index 3f70767997..21f97cc3fd 100644 --- a/activesupport/test/core_ext/object/to_query_test.rb +++ b/activesupport/test/core_ext/object/to_query_test.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require_relative "../../abstract_unit" -require "active_support/ordered_hash" require "active_support/core_ext/object/to_query" require "active_support/core_ext/string/output_safety" diff --git a/activesupport/test/hash_with_indifferent_access_test.rb b/activesupport/test/hash_with_indifferent_access_test.rb index b42116cab9..fbb4fb9715 100644 --- a/activesupport/test/hash_with_indifferent_access_test.rb +++ b/activesupport/test/hash_with_indifferent_access_test.rb @@ -4,7 +4,6 @@ require_relative "abstract_unit" require "active_support/core_ext/hash" require "bigdecimal" require "active_support/core_ext/string/access" -require "active_support/ordered_hash" require "active_support/core_ext/object/conversions" require "active_support/core_ext/object/deep_dup" require "active_support/inflections" diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 41c9959705..9ab9fba318 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -446,7 +446,7 @@ NOTE: Defined in `active_support/core_ext/object/with_options.rb`. ### JSON support -Active Support provides a better implementation of `to_json` than the `json` gem ordinarily provides for Ruby objects. This is because some classes, like `Hash`, `OrderedHash` and `Process::Status` need special handling in order to provide a proper JSON representation. +Active Support provides a better implementation of `to_json` than the `json` gem ordinarily provides for Ruby objects. This is because some classes, like `Hash` and `Process::Status` need special handling in order to provide a proper JSON representation. NOTE: Defined in `active_support/core_ext/object/json.rb`.