aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG.md5
-rw-r--r--activerecord/lib/active_record/connection_handling.rb8
-rw-r--r--activerecord/lib/active_record/query_cache.rb8
-rw-r--r--activerecord/lib/active_record/runtime_registry.rb4
-rw-r--r--activerecord/test/cases/query_cache_test.rb12
5 files changed, 9 insertions, 28 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index 0bd3c2e78c..0feda36a83 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,3 +1,8 @@
+* Removed the unused methods `ActiveRecord::Base.connection_id` and
+ `ActiveRecord::Base.connection_id=`
+
+ *Sean Griffin*
+
* Ensure hashes can be assigned to attributes created using `composed_of`.
Fixes #25210.
diff --git a/activerecord/lib/active_record/connection_handling.rb b/activerecord/lib/active_record/connection_handling.rb
index 99fdef67d0..f735bc697b 100644
--- a/activerecord/lib/active_record/connection_handling.rb
+++ b/activerecord/lib/active_record/connection_handling.rb
@@ -98,14 +98,6 @@ module ActiveRecord
@connection_specification_name
end
- def connection_id
- ActiveRecord::RuntimeRegistry.connection_id ||= Thread.current.object_id
- end
-
- def connection_id=(connection_id)
- ActiveRecord::RuntimeRegistry.connection_id = connection_id
- end
-
# Returns the configuration of the associated connection as a hash:
#
# ActiveRecord::Base.connection_config
diff --git a/activerecord/lib/active_record/query_cache.rb b/activerecord/lib/active_record/query_cache.rb
index 07d863d15e..fa3e306b3e 100644
--- a/activerecord/lib/active_record/query_cache.rb
+++ b/activerecord/lib/active_record/query_cache.rb
@@ -26,16 +26,12 @@ module ActiveRecord
def self.run
connection = ActiveRecord::Base.connection
enabled = connection.query_cache_enabled
- connection_id = ActiveRecord::Base.connection_id
connection.enable_query_cache!
- [enabled, connection_id]
+ enabled
end
- def self.complete(state)
- enabled, connection_id = state
-
- ActiveRecord::Base.connection_id = connection_id
+ def self.complete(enabled)
ActiveRecord::Base.connection.clear_query_cache
ActiveRecord::Base.connection.disable_query_cache! unless enabled
end
diff --git a/activerecord/lib/active_record/runtime_registry.rb b/activerecord/lib/active_record/runtime_registry.rb
index 56e88bc661..9e86999c1b 100644
--- a/activerecord/lib/active_record/runtime_registry.rb
+++ b/activerecord/lib/active_record/runtime_registry.rb
@@ -12,9 +12,9 @@ module ActiveRecord
class RuntimeRegistry # :nodoc:
extend ActiveSupport::PerThreadRegistry
- attr_accessor :connection_handler, :sql_runtime, :connection_id
+ attr_accessor :connection_handler, :sql_runtime
- [:connection_handler, :sql_runtime, :connection_id].each do |val|
+ [:connection_handler, :sql_runtime].each do |val|
class_eval %{ def self.#{val}; instance.#{val}; end }, __FILE__, __LINE__
class_eval %{ def self.#{val}=(x); instance.#{val}=x; end }, __FILE__, __LINE__
end
diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb
index d5c01315c1..03ec063671 100644
--- a/activerecord/test/cases/query_cache_test.rb
+++ b/activerecord/test/cases/query_cache_test.rb
@@ -39,18 +39,6 @@ class QueryCacheTest < ActiveRecord::TestCase
assert ActiveRecord::Base.connection.query_cache_enabled, 'cache on'
end
- def test_exceptional_middleware_assigns_original_connection_id_on_error
- connection_id = ActiveRecord::Base.connection_id
-
- mw = middleware { |env|
- ActiveRecord::Base.connection_id = self.object_id
- raise "lol borked"
- }
- assert_raises(RuntimeError) { mw.call({}) }
-
- assert_equal connection_id, ActiveRecord::Base.connection_id
- end
-
def test_middleware_delegates
called = false
mw = middleware { |env|