From 507c9970ab2d9e8296d605bc94843e2aa62aa5fd Mon Sep 17 00:00:00 2001 From: Kasper Timm Hansen Date: Mon, 20 Feb 2017 22:15:31 +0100 Subject: Revert "Merge pull request #27925 from robin850/hwia-removal" Pointed out by @matthewd that the HWIA subclass changes the AS scoped class and top-level HWIA hierarchies out from under existing classes. This reverts commit 71da39097b67114329be6d8db7fe6911124531af, reversing changes made to 41c33bd4b2ec3f4a482e6030b6fda15091d81e4a. --- .../lib/active_record/attribute_methods/dirty.rb | 6 +++--- activesupport/CHANGELOG.md | 6 ------ .../active_support/hash_with_indifferent_access.rb | 18 +---------------- activesupport/test/core_ext/hash_ext_test.rb | 23 ---------------------- 4 files changed, 4 insertions(+), 49 deletions(-) diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb index 6aa414ba6b..31c1e687dc 100644 --- a/activerecord/lib/active_record/attribute_methods/dirty.rb +++ b/activerecord/lib/active_record/attribute_methods/dirty.rb @@ -50,7 +50,7 @@ module ActiveRecord super.tap do @previous_mutation_tracker = nil clear_mutation_trackers - @changed_attributes = ActiveSupport::HashWithIndifferentAccess.new + @changed_attributes = HashWithIndifferentAccess.new end end @@ -70,13 +70,13 @@ module ActiveRecord def changes_applied @previous_mutation_tracker = mutation_tracker - @changed_attributes = ActiveSupport::HashWithIndifferentAccess.new + @changed_attributes = HashWithIndifferentAccess.new clear_mutation_trackers end def clear_changes_information @previous_mutation_tracker = nil - @changed_attributes = ActiveSupport::HashWithIndifferentAccess.new + @changed_attributes = HashWithIndifferentAccess.new forget_attribute_assignments clear_mutation_trackers end diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 788ea88752..2fb7f29d73 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,9 +1,3 @@ -* Deprecated the top level `HashWithIndifferentAccess` constant. - - Only `ActiveSupport::HashWithIndifferentAccess` should be used now. - - *Robin Dupret* (#27925) - * Deprecate `.halt_callback_chains_on_return_false`. *Rafael Mendonça França* diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index 8638667082..79e7feaf47 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -316,20 +316,4 @@ module ActiveSupport end end -class HashWithIndifferentAccess < ActiveSupport::HashWithIndifferentAccess - def initialize(*) - ActiveSupport::Deprecation.warn "HashWithIndifferentAccess is deprecated!" \ - "Use ActiveSupport::HashWithIndifferentAccess instead." - super - end - - def self.inherited(*) - ActiveSupport::Deprecation.warn "HashWithIndifferentAccess is deprecated!" \ - "Use ActiveSupport::HashWithIndifferentAccess instead." - super - end - - def encode_with(coder) - coder.represent_object(nil, ActiveSupport::HashWithIndifferentAccess.new(self)) - end -end +HashWithIndifferentAccess = ActiveSupport::HashWithIndifferentAccess diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 042bb60a22..05813ad388 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -8,8 +8,6 @@ require "active_support/core_ext/object/deep_dup" require "active_support/inflections" class HashExtTest < ActiveSupport::TestCase - HashWithIndifferentAccess = ActiveSupport::HashWithIndifferentAccess - class IndifferentHash < ActiveSupport::HashWithIndifferentAccess end @@ -1080,25 +1078,6 @@ class HashExtTest < ActiveSupport::TestCase assert_equal 1, hash[:a] assert_equal 3, hash[:b] end - - def test_top_level_hash_with_indifferent_access_is_deprecated - assert_deprecated do - ::HashWithIndifferentAccess.new - end - end - - def test_top_level_hash_with_indifferent_access_can_be_extended - assert_deprecated do - Class.new(::HashWithIndifferentAccess) - end - end - - def test_yaml_encoding_outputs_an_activesupport_namespaced_constant - ActiveSupport::Deprecation.silence do - instance = ::HashWithIndifferentAccess.new - assert_includes instance.to_yaml, "ActiveSupport::HashWithIndifferentAccess" - end - end end class IWriteMyOwnXML @@ -1144,8 +1123,6 @@ class HashExtToParamTests < ActiveSupport::TestCase end class HashToXmlTest < ActiveSupport::TestCase - HashWithIndifferentAccess = ActiveSupport::HashWithIndifferentAccess - def setup @xml_options = { root: :person, skip_instruct: true, indent: 0 } end -- cgit v1.2.3