diff options
-rw-r--r-- | activerecord/lib/active_record/railtie.rb | 13 | ||||
-rw-r--r-- | railties/test/application/initializers/frameworks_test.rb | 12 | ||||
-rw-r--r-- | railties/test/application/middleware_test.rb | 1 |
3 files changed, 7 insertions, 19 deletions
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 78fdb77216..94dda4e413 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -16,7 +16,11 @@ module ActiveRecord 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 @@ module ActiveRecord 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 diff --git a/railties/test/application/initializers/frameworks_test.rb b/railties/test/application/initializers/frameworks_test.rb index d8e916f45f..4ff10091b1 100644 --- a/railties/test/application/initializers/frameworks_test.rb +++ b/railties/test/application/initializers/frameworks_test.rb @@ -98,17 +98,7 @@ module ApplicationTests 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 diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb index 1f127cee78..ed8f70dc44 100644 --- a/railties/test/application/middleware_test.rb +++ b/railties/test/application/middleware_test.rb @@ -28,6 +28,7 @@ module ApplicationTests "ActionDispatch::RemoteIp", "Rack::Sendfile", "ActionDispatch::Callbacks", + "ActiveRecord::ConnectionAdapters::ConnectionManagement", "ActiveRecord::QueryCache", "ActionDispatch::Cookies", "ActionDispatch::Session::CookieStore", |