diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-09-21 16:19:42 -0400 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-09-21 16:19:42 -0400 |
commit | 6fd9298272518f4a25a1494b1b1c860bda2dd6b4 (patch) | |
tree | a892b48fe674bd0024518a4173708d385bbe3536 /activerecord | |
parent | b1223458979adc29117ffa1392526c6a166effed (diff) | |
download | rails-6fd9298272518f4a25a1494b1b1c860bda2dd6b4.tar.gz rails-6fd9298272518f4a25a1494b1b1c860bda2dd6b4.tar.bz2 rails-6fd9298272518f4a25a1494b1b1c860bda2dd6b4.zip |
No private def in the codebase
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 8 | ||||
-rw-r--r-- | activerecord/test/cases/query_cache_test.rb | 21 |
2 files changed, 16 insertions, 13 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index 5d4fc8324f..af37fcc1f1 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -43,9 +43,11 @@ module ActiveRecord } class StatementPool < ConnectionAdapters::StatementPool # :nodoc: - private def dealloc(stmt) - stmt.close - end + private + + def dealloc(stmt) + stmt.close + end end def initialize(connection, logger, connection_options, config) diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb index 69be091869..3eb4e04cb7 100644 --- a/activerecord/test/cases/query_cache_test.rb +++ b/activerecord/test/cases/query_cache_test.rb @@ -55,16 +55,6 @@ class QueryCacheTest < ActiveRecord::TestCase assert_cache :off end - private def with_temporary_connection_pool - old_pool = ActiveRecord::Base.connection_handler.retrieve_connection_pool(ActiveRecord::Base.connection_specification_name) - new_pool = ActiveRecord::ConnectionAdapters::ConnectionPool.new ActiveRecord::Base.connection_pool.spec - ActiveRecord::Base.connection_handler.send(:owner_to_pool)["primary"] = new_pool - - yield - ensure - ActiveRecord::Base.connection_handler.send(:owner_to_pool)["primary"] = old_pool - end - def test_query_cache_across_threads with_temporary_connection_pool do begin @@ -495,6 +485,17 @@ class QueryCacheTest < ActiveRecord::TestCase end private + + def with_temporary_connection_pool + old_pool = ActiveRecord::Base.connection_handler.retrieve_connection_pool(ActiveRecord::Base.connection_specification_name) + new_pool = ActiveRecord::ConnectionAdapters::ConnectionPool.new ActiveRecord::Base.connection_pool.spec + ActiveRecord::Base.connection_handler.send(:owner_to_pool)["primary"] = new_pool + + yield + ensure + ActiveRecord::Base.connection_handler.send(:owner_to_pool)["primary"] = old_pool + end + def middleware(&app) executor = Class.new(ActiveSupport::Executor) ActiveRecord::QueryCache.install_executor_hooks executor |