Alder Green
2006-Aug-29 16:25 UTC
How do you pass params from one action to another you redirect_to?
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? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Klondike
2006-Sep-01 13:42 UTC
Re: How do you pass params from one action to another you redirect_to?
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? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---