We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4ace047 commit ceb4b94Copy full SHA for ceb4b94
actionpack/lib/action_dispatch/middleware/stack.rb
@@ -170,13 +170,19 @@ def build(app = nil, &block)
170
171
private
172
def assert_index(index, where)
173
- i = index.is_a?(Integer) ? index : middlewares.index { |m| m.klass == index }
+ i = index.is_a?(Integer) ? index : index_of(index)
174
raise "No such middleware to insert #{where}: #{index.inspect}" unless i
175
i
176
end
177
178
def build_middleware(klass, args, block)
179
Middleware.new(klass, args, block)
180
181
+
182
+ def index_of(klass)
183
+ middlewares.index do |m|
184
+ m.name == klass.name
185
+ end
186
187
188
0 commit comments