1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Complain if there's no such middleware

This commit is contained in:
Jeremy Kemper 2009-12-28 20:18:14 -08:00
parent 4ee70643b3
commit f79caa49fb

View file

@ -93,8 +93,9 @@ module ActionDispatch
alias_method :insert_before, :insert
def insert_after(index, *args, &block)
index = self.index(index) unless index.is_a?(Integer)
insert(index + 1, *args, &block)
i = index.is_a?(Integer) ? index : self.index(index)
raise "No such middleware to insert after: #{index.inspect}" unless i
insert(i + 1, *args, &block)
end
def swap(target, *args, &block)