diff options
author | José Valim <jose.valim@plataformatec.com.br> | 2012-02-04 06:31:59 -0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-02-04 15:32:40 +0100 |
commit | 9cb0e12e46e0385b132dbe8716097225b7ef0863 (patch) | |
tree | 2bc8d0700dd74f1ef6a87ce56ec70f2386972b64 /actionpack/lib/action_dispatch | |
parent | 9aa4c6d7ce0707fe7e43bc919618d804836e1d71 (diff) | |
download | rails-9cb0e12e46e0385b132dbe8716097225b7ef0863.tar.gz rails-9cb0e12e46e0385b132dbe8716097225b7ef0863.tar.bz2 rails-9cb0e12e46e0385b132dbe8716097225b7ef0863.zip |
Merge pull request #4879 from kennyj/fix_4873
Fix GH #4873. Allow swapping same class 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 a4308f528c..28e8fbdab8 100644 --- a/actionpack/lib/action_dispatch/middleware/stack.rb +++ b/actionpack/lib/action_dispatch/middleware/stack.rb @@ -93,8 +93,9 @@ module ActionDispatch end def swap(target, *args, &block) - insert_before(target, *args, &block) - delete(target) + index = assert_index(target, :before) + insert(index, *args, &block) + middlewares.delete_at(index + 1) end def delete(target) |