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/lib/rails | |
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/lib/rails')
-rw-r--r-- | railties/lib/rails/console_app.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/initializer.rb | 14 |
2 files changed, 14 insertions, 2 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 |