From b0506b086fa1b59b072aaf7de99f01846fce10a4 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 26 Sep 2009 21:07:49 -0500 Subject: Create separate middleware stack for initializer --- railties/lib/rails/configuration.rb | 5 ++--- railties/lib/rails/initializer.rb | 1 + railties/test/fcgi_dispatcher_test.rb | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index f6159b9347..4a70a4800e 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -108,10 +108,9 @@ module Rails defined?(::RAILS_FRAMEWORK_ROOT) ? ::RAILS_FRAMEWORK_ROOT : "#{root_path}/vendor/rails" end - # TODO: Fix this when there is an application object def middleware - require 'action_controller' - ActionController::Dispatcher.middleware + require 'action_dispatch' + @middleware ||= ActionDispatch::MiddlewareStack.new end # Loads and returns the contents of the #database_configuration_file. The diff --git a/railties/lib/rails/initializer.rb b/railties/lib/rails/initializer.rb index d05cb69ffe..399ce26618 100644 --- a/railties/lib/rails/initializer.rb +++ b/railties/lib/rails/initializer.rb @@ -608,6 +608,7 @@ Run `rake gems:install` to install the missing gems. Initializer.default.add :build_application do if configuration.frameworks.include?(:action_controller) + ActionController::Dispatcher.middleware = configuration.middleware Rails.application = Rails::Application.new end end diff --git a/railties/test/fcgi_dispatcher_test.rb b/railties/test/fcgi_dispatcher_test.rb index 7bf2b24c07..1e704b862f 100644 --- a/railties/test/fcgi_dispatcher_test.rb +++ b/railties/test/fcgi_dispatcher_test.rb @@ -5,8 +5,6 @@ uses_gem "fcgi", "0.8.7" do require 'action_controller' require 'rails/fcgi_handler' -Dispatcher.middleware.clear - class RailsFCGIHandlerTest < Test::Unit::TestCase def setup @log = StringIO.new -- cgit v1.2.3