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:
parent
4ee70643b3
commit
f79caa49fb
1 changed files with 3 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue