diff options
author | Sparky <sparky@Sparkys-iMac.local> | 2010-09-15 12:58:49 -0700 |
---|---|---|
committer | Sparky <sparky@Sparkys-iMac.local> | 2010-09-15 12:58:49 -0700 |
commit | eeb324699169ad52d7e771ded20310afce62927d (patch) | |
tree | 7d56a6af4856213335d33a1fccac14ac75710331 /railties/lib/rails | |
parent | dd6efe98b62946ae4d4df0672292449226b8d6fc (diff) | |
download | rails-eeb324699169ad52d7e771ded20310afce62927d.tar.gz rails-eeb324699169ad52d7e771ded20310afce62927d.tar.bz2 rails-eeb324699169ad52d7e771ded20310afce62927d.zip |
Only add Rack::Cache to the middleware stack if config.action_controller.perform_caching is set.
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/application.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index b923fedab7..0e85e6d1d5 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -147,9 +147,11 @@ module Rails def default_middleware_stack ActionDispatch::MiddlewareStack.new.tap do |middleware| - require "action_dispatch/http/rack_cache" if config.action_dispatch.rack_cache + rack_cache = config.action_controller.perform_caching && config.action_dispatch.rack_cache - middleware.use ::Rack::Cache, config.action_dispatch.rack_cache if config.action_dispatch.rack_cache + require "action_dispatch/http/rack_cache" if rack_cache + + middleware.use ::Rack::Cache, rack_cache if rack_cache middleware.use ::ActionDispatch::Static, config.static_asset_paths if config.serve_static_assets middleware.use ::Rack::Lock if !config.allow_concurrency middleware.use ::Rack::Runtime |