paramaters problem

Hi everybody,

I have paramaters like this

this is action on controller side :action => 'new', :result => session %> and this is view side test_controller/new?&&&&&result[user]=2

user controller @user = User.find(params[:result]) I coudn`t get the value with params it gives me user2 result. but I want only 2

how can I come through this problem? please help

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:


Good luck, Casey