diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-09-26 13:41:32 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-09-26 13:41:32 -0500 |
commit | 1f7270057596592946a877cd029d95760ba3e5ee (patch) | |
tree | e891a72411b14502145073dda08ae8105e794295 /railties | |
parent | 71b33ec482404f6e48c651eb868243ed0b6c4175 (diff) | |
download | rails-1f7270057596592946a877cd029d95760ba3e5ee.tar.gz rails-1f7270057596592946a877cd029d95760ba3e5ee.tar.bz2 rails-1f7270057596592946a877cd029d95760ba3e5ee.zip |
Move default middleware stack into initializer
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/console_app.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/initializer.rb | 14 | ||||
-rw-r--r-- | railties/test/console_app_test.rb | 5 |
3 files changed, 14 insertions, 7 deletions
diff --git a/railties/lib/rails/console_app.rb b/railties/lib/rails/console_app.rb index 75e6f11ea3..5ce3d0d13b 100644 --- a/railties/lib/rails/console_app.rb +++ b/railties/lib/rails/console_app.rb @@ -25,7 +25,7 @@ end #reloads the environment def reload! puts "Reloading..." - ActionController::Dispatcher.new + ActionDispatch::Callbacks.new(lambda {}, true) ActionController::Dispatcher.router.reload true end diff --git a/railties/lib/rails/initializer.rb b/railties/lib/rails/initializer.rb index 72d23f2642..d05cb69ffe 100644 --- a/railties/lib/rails/initializer.rb +++ b/railties/lib/rails/initializer.rb @@ -272,7 +272,19 @@ module Rails # Include middleware to serve up static assets Initializer.default.add :initialize_static_server do if configuration.frameworks.include?(:action_controller) && configuration.serve_static_assets - configuration.middleware.insert(0, ActionDispatch::Static, Rails.public_path) + configuration.middleware.use(ActionDispatch::Static, Rails.public_path) + end + end + + Initializer.default.add :initialize_middleware_stack do + if configuration.frameworks.include?(:action_controller) + configuration.middleware.use(::Rack::Lock) unless ActionController::Base.allow_concurrency + configuration.middleware.use(ActionDispatch::ShowExceptions, ActionController::Base.consider_all_requests_local) + configuration.middleware.use(ActionDispatch::Callbacks, ActionController::Dispatcher.prepare_each_request) + configuration.middleware.use(lambda { ActionController::Base.session_store }, lambda { ActionController::Base.session_options }) + configuration.middleware.use(ActionDispatch::ParamsParser) + configuration.middleware.use(::Rack::MethodOverride) + configuration.middleware.use(::Rack::Head) end end diff --git a/railties/test/console_app_test.rb b/railties/test/console_app_test.rb index a26a8895ec..d2512a4987 100644 --- a/railties/test/console_app_test.rb +++ b/railties/test/console_app_test.rb @@ -2,11 +2,6 @@ require 'abstract_unit' require 'action_controller' # console_app uses 'action_controller/integration' -unless defined? ApplicationController - class ApplicationController < ActionController::Base; end - ActionController::Base.session_store = nil -end - require 'rails/dispatcher' require 'rails/console_app' |