Skip to content
This repository
Browse code

Move Rack::Cache after AD::Static in the stack

  • Loading branch information...
commit 210d0c7b412760f3efeb0924100479106cfa4817 1 parent a6e1a73
Jonathan Baudanza jbaudanza authored
10 railties/lib/rails/application/default_middleware_stack.rb
@@ -11,11 +11,6 @@ def initialize(app, config, paths)
11 11
12 12 def build_stack
13 13 ActionDispatch::MiddlewareStack.new.tap do |middleware|
14   - if rack_cache = load_rack_cache
15   - require "action_dispatch/http/rack_cache"
16   - middleware.use ::Rack::Cache, rack_cache
17   - end
18   -
19 14 if config.force_ssl
20 15 middleware.use ::ActionDispatch::SSL, config.ssl_options
21 16 end
@@ -26,6 +21,11 @@ def build_stack
26 21 middleware.use ::ActionDispatch::Static, paths["public"].first, config.static_cache_control
27 22 end
28 23
  24 + if rack_cache = load_rack_cache
  25 + require "action_dispatch/http/rack_cache"
  26 + middleware.use ::Rack::Cache, rack_cache
  27 + end
  28 +
29 29 middleware.use ::Rack::Lock unless allow_concurrency?
30 30 middleware.use ::Rack::Runtime
31 31 middleware.use ::Rack::MethodOverride
2  railties/test/application/middleware_test.rb
@@ -61,7 +61,7 @@ def app
61 61
62 62 boot!
63 63
64   - assert_equal "Rack::Cache", middleware.first
  64 + assert middleware.include?("Rack::Cache")
65 65 end
66 66
67 67 test "ActiveRecord::Migration::CheckPending is present when active_record.migration_error is set to :page_load" do

0 comments on commit 210d0c7

Please sign in to comment.
Something went wrong with that request. Please try again.