The reason you were getting an incorrect parameter is that the method,
“session”, returns a hash, not a string. So calling session returns
something like {:user => “2”}. When you pass a hash to the redirect
method, it tries to turn it into a string using the “to_s” method on a
hash, which just jams the key/value pairs together in a string:
{:user => “2”}.to_s
=> “user2”
If I understand what you are trying to do, you should specify the user
key in your session in your controller’s redirect method:
:action => ‘new’, :result => session[:user]
that will redirect the browser to the URL:
test_controller/new?result=2
Good luck,
Casey
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.