diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-12-28 20:18:14 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-12-28 20:24:28 -0800 |
commit | f79caa49fb78bca986a4321830c4cd155c17e13a (patch) | |
tree | 96893d8de6ebea8689e68b6efb7fe18c06e3b22f /actionpack/lib/action_dispatch | |
parent | 4ee70643b3c352a582069267ddb02186da8a86f7 (diff) | |
download | rails-f79caa49fb78bca986a4321830c4cd155c17e13a.tar.gz rails-f79caa49fb78bca986a4321830c4cd155c17e13a.tar.bz2 rails-f79caa49fb78bca986a4321830c4cd155c17e13a.zip |
Complain if there's no such middleware
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/stack.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/stack.rb b/actionpack/lib/action_dispatch/middleware/stack.rb index 3b27309f58..24be4fee55 100644 --- a/actionpack/lib/action_dispatch/middleware/stack.rb +++ b/actionpack/lib/action_dispatch/middleware/stack.rb @@ -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) |