# Paramaters problem

**URL:** <https://www.ruby-forum.com/t/paramaters-problem/181142>\
**Category:** Rails\
**Created:** [January 6, 2010, 8:34am UTC](https://www.ruby-forum.com/t/paramaters-problem/181142 "2010-01-06T08:34:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ac91a4/32.png) [@ahmet](https://www.ruby-forum.com/u/ahmet)\
**Post date:** [January 6, 2010, 8:34am UTC](https://www.ruby-forum.com/t/paramaters-problem/181142/1 "2010-01-06T08:34:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ahmet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ac91a4/32.png) [@ahmet](https://www.ruby-forum.com/u/ahmet)\
**Post date:** [January 6, 2010, 4:06pm UTC](https://www.ruby-forum.com/t/paramaters-problem/181142/2 "2010-01-06T16:06:21Z")

</div>

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
