Skip to content

Commit

Permalink
Move Rack::Cache after AD::Static in the stack
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaudanza committed Sep 26, 2013
1 parent a6e1a73 commit 210d0c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions railties/lib/rails/application/default_middleware_stack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ def initialize(app, config, paths)

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
Expand All @@ -26,6 +21,11 @@ def build_stack
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
Expand Down
2 changes: 1 addition & 1 deletion railties/test/application/middleware_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def app

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
Expand Down

0 comments on commit 210d0c7

Please sign in to comment.