diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-12-22 12:04:32 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-12-22 12:04:32 -0600 |
commit | 0b22a96b7aa39cb7244d7cee23f3d03b6117b447 (patch) | |
tree | 4300480830267a58142a4efe60b76099b6efad8e /actionpack/lib/action_controller | |
parent | aa002c0e86afdc83693f14667a710107843f0fbd (diff) | |
download | rails-0b22a96b7aa39cb7244d7cee23f3d03b6117b447.tar.gz rails-0b22a96b7aa39cb7244d7cee23f3d03b6117b447.tar.bz2 rails-0b22a96b7aa39cb7244d7cee23f3d03b6117b447.zip |
Move default middleware stack to middlewares.rb
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/dispatcher.rb | 19 | ||||
-rw-r--r-- | actionpack/lib/action_controller/middlewares.rb | 19 |
2 files changed, 21 insertions, 17 deletions
diff --git a/actionpack/lib/action_controller/dispatcher.rb b/actionpack/lib/action_controller/dispatcher.rb index 0cfd451c04..ae9f117e3f 100644 --- a/actionpack/lib/action_controller/dispatcher.rb +++ b/actionpack/lib/action_controller/dispatcher.rb @@ -44,23 +44,8 @@ module ActionController cattr_accessor :middleware self.middleware = MiddlewareStack.new do |middleware| - middleware.use "ActionController::Lock", :if => lambda { - !ActionController::Base.allow_concurrency - } - middleware.use "ActionController::Failsafe" - middleware.use "ActiveRecord::QueryCache" if defined?(ActiveRecord) - - ["ActionController::Session::CookieStore", - "ActionController::Session::MemCacheStore", - "ActiveRecord::SessionStore"].each do |store| - middleware.use(store, ActionController::Base.session_options, - :if => lambda { - if session_store = ActionController::Base.session_store - session_store.name == store - end - } - ) - end + middlewares = File.join(File.dirname(__FILE__), "middlewares.rb") + middleware.instance_eval(File.read(middlewares)) end include ActiveSupport::Callbacks diff --git a/actionpack/lib/action_controller/middlewares.rb b/actionpack/lib/action_controller/middlewares.rb new file mode 100644 index 0000000000..e566c6fef9 --- /dev/null +++ b/actionpack/lib/action_controller/middlewares.rb @@ -0,0 +1,19 @@ +use "ActionController::Lock", :if => lambda { + !ActionController::Base.allow_concurrency +} + +use "ActionController::Failsafe" + +use "ActiveRecord::QueryCache", :if => lambda { defined?(ActiveRecord) } + +["ActionController::Session::CookieStore", + "ActionController::Session::MemCacheStore", + "ActiveRecord::SessionStore"].each do |store| + use(store, ActionController::Base.session_options, + :if => lambda { + if session_store = ActionController::Base.session_store + session_store.name == store + end + } + ) +end |