How do you pass params from one action to another you redire

Suppose action foo #redirects_to action bar. Once #redirected_to, bar
would not have action foo’s params.

One simple solution is:

params[:action] = ‘bar’
redirect_to(params)

With that params is preserved in bar. The problem is that the HTTP
method of bar is GET, so the params are shown in the URL.

Any better solution?

More broadly, any other way to pass data between foo and bar, besides
sticking it in session?

I think traditionally, the two solutions to this problem are to

a.) Shove everything into the session hash and lug the params around.
b.) Create a hidden form input field for each value so that when the
form is submitted they get passed on again.

They both aren’t great. Using the session means that your data could
bleed around and be present all over your application unless you ensure
it gets cleared out correctly on the next action. And creating form
input fields can get messy and brittle when the amount of params you
want to transfer is large.

Is there a c.) anyone can recommend? Actually, one simple solution
might be to do what you’re doing above, but make it use POST somehow
instead of GET. Is there any way to do that?

Suppose action foo #redirects_to action bar. Once #redirected_to, bar
would not have action foo’s params.

One simple solution is:

params[:action] = ‘bar’
redirect_to(params)

With that params is preserved in bar. The problem is that the HTTP
method of bar is GET, so the params are shown in the URL.

Any better solution?

More broadly, any other way to pass data between foo and bar, besides
sticking it in session?