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

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.

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs