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??? --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Shandy Nantz
2007-Jul-31 14:49 UTC
Re: How to use redirect_to :action => ''something'', params
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Nikos D.
2007-Jul-31 15:52 UTC
Re: How to use redirect_to :action => ''something'', params
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 Nantz <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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 > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---