mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
No private def in the codebase
This commit is contained in:
parent
b122345897
commit
6fd9298272
2 changed files with 16 additions and 13 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue