# Can't follow redirects outside current controller - but it's

**URL:** <https://www.ruby-forum.com/t/cant-follow-redirects-outside-current-controller-but-its/88527>\
**Category:** Rails\
**Created:** [March 12, 2007, 11:42am UTC](https://www.ruby-forum.com/t/cant-follow-redirects-outside-current-controller-but-its/88527 "2007-03-12T11:42:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gwyn\_Morfey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f9ae1b/32.png) [@Gwyn\_Morfey](https://www.ruby-forum.com/u/Gwyn_Morfey)\
**Post date:** [March 12, 2007, 11:42am UTC](https://www.ruby-forum.com/t/cant-follow-redirects-outside-current-controller-but-its/88527/1 "2007-03-12T11:42:10Z")

</div>

Running a functional test on FooController that does  
‘follow\_redirect’, I get 'Can’t follow redirects outside current  
controller (from “foo” to “foo”). On further investigation, it turns  
out that :foo != ‘foo’ around line 401 of actionpack/lib/  
action\_controller/test\_process.rb. Changing the line:

if redirected\_controller && redirected\_controller !=  
@controller.controller\_name

to

if redirected\_controller && redirected\_controller.to\_s !=  
@controller.controller\_name.to\_s

fixes the problem. Has anyone else hit this? The method in question is  
just doing ‘redirect\_to :action=\>:someaction’.

Gwyn.

---

<div class="post-metadata">

**Author:** ![Gwyn\_Morfey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f9ae1b/32.png) [@Gwyn\_Morfey](https://www.ruby-forum.com/u/Gwyn_Morfey)\
**Post date:** [March 12, 2007, 12:03pm UTC](https://www.ruby-forum.com/t/cant-follow-redirects-outside-current-controller-but-its/88527/2 "2007-03-12T12:03:12Z")

</div>

It seems that the proper form of redirect\_to is:

redirect\_to :controller=\>‘foo’,:action=\>‘bar’,

Not:

redirect\_to :controller=\>:foo,:action=\>:bar

Consistently using strings in both redirect\_to and  
assert\_redirected\_to fixes this problem.
