# How to use redirect\_to :action =\> 'something', params

**URL:** <https://www.ruby-forum.com/t/how-to-use-redirect-to-action-something-params/110845>\
**Category:** Rails\
**Created:** [July 31, 2007, 3:03pm UTC](https://www.ruby-forum.com/t/how-to-use-redirect-to-action-something-params/110845 "2007-07-31T15:03:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![demisone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/977dab/32.png) [@demisone](https://www.ruby-forum.com/u/demisone)\
**Post date:** [July 31, 2007, 3:03pm UTC](https://www.ruby-forum.com/t/how-to-use-redirect-to-action-something-params/110845/1 "2007-07-31T15:03:37Z")

</div>

Hi there. I wanted to redirect to some page and at the same time keep  
the parameters that arrived on the current request so i wrote the  
following code:

redirect\_to :action =\> ‘some\_action\_here’, params

Although it is a hash (the params) and a valid one, it doesn’t work. I  
assume it expects something like

redirect\_to :action =\> ‘some\_actio\_here’, {:param1 =\>  
‘something’, :param2 =\> ‘something else’ }

but i don’t want to hard code it. I want to resend all the params…

Any ideas???

---

<div class="post-metadata">

**Author:** ![demisone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/977dab/32.png) [@demisone](https://www.ruby-forum.com/u/demisone)\
**Post date:** [July 31, 2007, 4:49pm UTC](https://www.ruby-forum.com/t/how-to-use-redirect-to-action-something-params/110845/2 "2007-07-31T16:49:12Z")

</div>

You want to assign the parameters on that page into a hash, for example,  
lets say you have a whole bunch of fields that are related to user info,  
you could say:

redirect\_to :action =\> ‘something’, :user =\> params[:user]

then you use the :user hash to pick at all the variables in the next  
page. So if you have multiple forms on the same page all containing  
different types of info, you just follow the same format only seperated  
by ‘,’. Hope this helps,

~S

---

<div class="post-metadata">

**Author:** ![demisone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/977dab/32.png) [@demisone](https://www.ruby-forum.com/u/demisone)\
**Post date:** [July 31, 2007, 5:53pm UTC](https://www.ruby-forum.com/t/how-to-use-redirect-to-action-something-params/110845/3 "2007-07-31T17:53:08Z")

</div>

Thanks for your interest but i figured out how to do what i wanted:

redirect\_to params.merge({:action =\> ‘something’})

So all of the params stayed untouched for the next controller/  
action 🙂

Thanks a lot again for your interest!

On Jul 31, 5:49 pm, Shandy N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
