Permalink
Browse files

Revert "Just add connection management middleware if running in a con…

…current environment."

This reverts commit 6b29dc8.
  • Loading branch information...
1 parent 3cd9627 commit c211d904ba358d3d1ae85d56fa3a805ea505c23a @jeremy jeremy committed Aug 21, 2010
@@ -16,7 +16,11 @@ class Railtie < Rails::Railtie
config.generators.orm :active_record, :migration => true,
:timestamps => true
- config.app_middleware.insert_after "::ActionDispatch::Callbacks", "ActiveRecord::QueryCache"
+ config.app_middleware.insert_after "::ActionDispatch::Callbacks",
+ "ActiveRecord::QueryCache"
+
+ config.app_middleware.insert_after "::ActionDispatch::Callbacks",
+ "ActiveRecord::ConnectionAdapters::ConnectionManagement"
rake_tasks do
load "active_record/railties/databases.rake"
@@ -74,13 +78,6 @@ class Railtie < Rails::Railtie
end
end
- initializer "active_record.add_concurrency_middleware" do |app|
- if app.config.allow_concurrency
- app.config.middleware.insert_after "::ActionDispatch::Callbacks",
- "ActiveRecord::ConnectionAdapters::ConnectionManagement"
- end
- end
-
config.after_initialize do
ActiveSupport.on_load(:active_record) do
instantiate_observers
@@ -98,17 +98,7 @@ def notify
require "#{app_path}/config/environment"
- expects = [ActiveRecord::QueryCache, ActiveRecord::SessionStore]
- middleware = Rails.application.config.middleware.map { |m| m.klass }
- assert_equal expects, middleware & expects
- end
-
- test "database middleware initializes when allow concurrency is true" do
- add_to_config "config.threadsafe!"
-
- require "#{app_path}/config/environment"
-
- expects = [ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache]
+ expects = [ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActiveRecord::SessionStore]
middleware = Rails.application.config.middleware.map { |m| m.klass }
assert_equal expects, middleware & expects
end
@@ -28,6 +28,7 @@ def app
"ActionDispatch::RemoteIp",
"Rack::Sendfile",
"ActionDispatch::Callbacks",
+ "ActiveRecord::ConnectionAdapters::ConnectionManagement",
"ActiveRecord::QueryCache",
"ActionDispatch::Cookies",
"ActionDispatch::Session::CookieStore",

0 comments on commit c211d90

Please sign in to comment.