Skip to content

Commit ceb4b94

Browse files
committed
Restore behavior added in ff66477
1 parent 4ace047 commit ceb4b94

File tree

1 file changed

+7
-1
lines changed
  • actionpack/lib/action_dispatch/middleware

1 file changed

+7
-1
lines changed

actionpack/lib/action_dispatch/middleware/stack.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,19 @@ def build(app = nil, &block)
170170

171171
private
172172
def assert_index(index, where)
173-
i = index.is_a?(Integer) ? index : middlewares.index { |m| m.klass == index }
173+
i = index.is_a?(Integer) ? index : index_of(index)
174174
raise "No such middleware to insert #{where}: #{index.inspect}" unless i
175175
i
176176
end
177177

178178
def build_middleware(klass, args, block)
179179
Middleware.new(klass, args, block)
180180
end
181+
182+
def index_of(klass)
183+
middlewares.index do |m|
184+
m.name == klass.name
185+
end
186+
end
181187
end
182188
end

0 commit comments

Comments
 (0)