aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-09-26 21:07:49 -0500
committerJoshua Peek <josh@joshpeek.com>2009-09-26 21:07:49 -0500
commitb0506b086fa1b59b072aaf7de99f01846fce10a4 (patch)
tree4beaa3d92a061df6ca0b5859c69fa64dcbe4f19c
parentacfeec515111d427b3a27aef3af034922e0d9248 (diff)
downloadrails-b0506b086fa1b59b072aaf7de99f01846fce10a4.tar.gz
rails-b0506b086fa1b59b072aaf7de99f01846fce10a4.tar.bz2
rails-b0506b086fa1b59b072aaf7de99f01846fce10a4.zip
Create separate middleware stack for initializer
-rw-r--r--railties/lib/rails/configuration.rb5
-rw-r--r--railties/lib/rails/initializer.rb1
-rw-r--r--railties/test/fcgi_dispatcher_test.rb2
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