Skip to content

Commit 99b38f3

Browse files
committed
Move AD::Cascade to the bottom of the middleware stack.
1 parent 4750e61 commit 99b38f3

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

railties/lib/rails/application/configuration.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ def default_middleware_stack
150150
middleware.use('::ActionDispatch::Cookies')
151151
middleware.use(lambda { session_store }, lambda { session_options })
152152
middleware.use('::ActionDispatch::Flash', :if => lambda { session_store })
153-
middleware.use(lambda { metal_loader.build_middleware(metals) }, :if => lambda { metal_loader.metals.any? })
154-
middleware.use('ActionDispatch::ParamsParser')
153+
middleware.use('::ActionDispatch::ParamsParser')
155154
middleware.use('::Rack::MethodOverride')
156155
middleware.use('::ActionDispatch::Head')
156+
middleware.use(lambda { metal_loader.build_middleware(metals) }, :if => lambda { metal_loader.metals.any? })
157157
end
158158
end
159159
end

railties/lib/rails/configuration.rb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,37 @@
55

66
module Rails
77
module Configuration
8+
class MiddlewareStackProxy #:nodoc:
9+
def initialize
10+
@operations = []
11+
end
12+
13+
def insert_before(*args, &block)
14+
@operations << [:insert_before, args, block]
15+
end
16+
17+
alias :insert :insert_before
18+
19+
def insert_after(*args, &block)
20+
@operations << [:insert_after, args, block]
21+
end
22+
23+
def swap(*args, &block)
24+
@operations << [:swap, args, block]
25+
end
26+
27+
def use(*args, &block)
28+
@operations << [:use, args, block]
29+
end
30+
31+
def merge_into(other)
32+
@operations.each do |operation, args, block|
33+
other.send(operation, *args, &block)
34+
end
35+
other
36+
end
37+
end
38+
839
class Generators #:nodoc:
940
attr_accessor :aliases, :options, :templates, :fallbacks, :colorize_logging
1041

railties/lib/rails/railtie/configuration.rb

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,6 @@
33
module Rails
44
class Railtie
55
class Configuration
6-
class MiddlewareStackProxy
7-
def initialize
8-
@operations = []
9-
end
10-
11-
def insert_before(*args, &block)
12-
@operations << [:insert_before, args, block]
13-
end
14-
15-
alias insert insert_before
16-
17-
def insert_after(*args, &block)
18-
@operations << [:insert_after, args, block]
19-
end
20-
21-
def swap(*args, &block)
22-
@operations << [:swap, args, block]
23-
end
24-
25-
def use(*args, &block)
26-
@operations << [:use, args, block]
27-
end
28-
29-
def merge_into(other)
30-
@operations.each do |operation, args, block|
31-
other.send(operation, *args, &block)
32-
end
33-
other
34-
end
35-
end
36-
376
def initialize
387
@@options ||= {}
398
end
@@ -44,7 +13,7 @@ def initialize
4413
# application once it is defined and the default_middlewares are
4514
# created
4615
def app_middleware
47-
@@app_middleware ||= MiddlewareStackProxy.new
16+
@@app_middleware ||= Rails::Configuration::MiddlewareStackProxy.new
4817
end
4918

5019
# Holds generators configuration:

0 commit comments

Comments
 (0)