From 210d0c7b412760f3efeb0924100479106cfa4817 Mon Sep 17 00:00:00 2001 From: Jonathan Baudanza Date: Wed, 25 Sep 2013 17:06:20 -0700 Subject: Move Rack::Cache after AD::Static in the stack --- railties/lib/rails/application/default_middleware_stack.rb | 10 +++++----- railties/test/application/middleware_test.rb | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/application/default_middleware_stack.rb b/railties/lib/rails/application/default_middleware_stack.rb index 570ff02c83..a00afe008c 100644 --- a/railties/lib/rails/application/default_middleware_stack.rb +++ b/railties/lib/rails/application/default_middleware_stack.rb @@ -11,11 +11,6 @@ module Rails def build_stack ActionDispatch::MiddlewareStack.new.tap do |middleware| - if rack_cache = load_rack_cache - require "action_dispatch/http/rack_cache" - middleware.use ::Rack::Cache, rack_cache - end - if config.force_ssl middleware.use ::ActionDispatch::SSL, config.ssl_options end @@ -26,6 +21,11 @@ module Rails middleware.use ::ActionDispatch::Static, paths["public"].first, config.static_cache_control end + if rack_cache = load_rack_cache + require "action_dispatch/http/rack_cache" + middleware.use ::Rack::Cache, rack_cache + end + middleware.use ::Rack::Lock unless allow_concurrency? middleware.use ::Rack::Runtime middleware.use ::Rack::MethodOverride diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb index 31a35a09bb..4d4e7b9540 100644 --- a/railties/test/application/middleware_test.rb +++ b/railties/test/application/middleware_test.rb @@ -61,7 +61,7 @@ module ApplicationTests boot! - assert_equal "Rack::Cache", middleware.first + assert middleware.include?("Rack::Cache") end test "ActiveRecord::Migration::CheckPending is present when active_record.migration_error is set to :page_load" do -- cgit v1.2.3