aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/initializer.rb6
-rw-r--r--railties/test/abstract_unit.rb2
-rw-r--r--railties/test/application/load_test.rb2
-rw-r--r--railties/test/initializer/path_test.rb3
4 files changed, 10 insertions, 3 deletions
diff --git a/railties/lib/rails/initializer.rb b/railties/lib/rails/initializer.rb
index 7501d4e0e2..8a34411ce7 100644
--- a/railties/lib/rails/initializer.rb
+++ b/railties/lib/rails/initializer.rb
@@ -510,7 +510,7 @@ Run `rake gems:install` to install the missing gems.
# # Setup database middleware after initializers have run
Initializer.default.add :initialize_database_middleware do
if configuration.frameworks.include?(:active_record)
- if configuration.frameworks.include?(:action_controller) &&
+ if configuration.frameworks.include?(:action_controller) && ActionController::Base.session_store &&
ActionController::Base.session_store.name == 'ActiveRecord::SessionStore'
configuration.middleware.insert_before :"ActiveRecord::SessionStore", ActiveRecord::ConnectionAdapters::ConnectionManagement
configuration.middleware.insert_before :"ActiveRecord::SessionStore", ActiveRecord::QueryCache
@@ -581,6 +581,8 @@ Run `rake gems:install` to install the missing gems.
end
Initializer.default.add :build_application do
- Rails.application = Rails::Application.new
+ if configuration.frameworks.include?(:action_controller)
+ Rails.application = Rails::Application.new
+ end
end
end
diff --git a/railties/test/abstract_unit.rb b/railties/test/abstract_unit.rb
index e78165fb8c..4510e6241c 100644
--- a/railties/test/abstract_unit.rb
+++ b/railties/test/abstract_unit.rb
@@ -18,6 +18,8 @@ require 'test/unit'
require 'active_support'
require 'active_support/test_case'
+require 'action_controller'
+
if defined?(RAILS_ROOT)
RAILS_ROOT.replace File.dirname(__FILE__)
else
diff --git a/railties/test/application/load_test.rb b/railties/test/application/load_test.rb
index c5bc80197d..75dbf56a21 100644
--- a/railties/test/application/load_test.rb
+++ b/railties/test/application/load_test.rb
@@ -1,6 +1,6 @@
require "isolation/abstract_unit"
require "rails"
-require "rack"
+require 'action_dispatch'
module ApplicationTests
class LoadTest < Test::Unit::TestCase
diff --git a/railties/test/initializer/path_test.rb b/railties/test/initializer/path_test.rb
index 8de3161546..f3d70ad4ca 100644
--- a/railties/test/initializer/path_test.rb
+++ b/railties/test/initializer/path_test.rb
@@ -6,6 +6,9 @@ class PathsTest < Test::Unit::TestCase
def self.setup
Rails::Initializer.run do |config|
config.frameworks = [:action_controller, :action_view, :action_mailer, :active_record]
+ config.after_initialize do
+ ActionController::Base.session_store = nil
+ end
end
end