Hi, What are the requirements for passing parameters in the url across any controller/action combinations? [from controller A...] redirect_to controller_b_action1_url(:desired_param=>''desired value'') [now from B#1...] redirect_to controller_b_action2_url(:desired_param=>params[:desired_param]) [from B#2...] redirect_to controller_a_action2_url(:desired_param=>params[:desired_param]) [now from A#2...] redirect_to controller_a_action3_url(:desired_param=>params[:desired_param]) Do my routes need to have only certain request actions associated, e.g., post or put, for this to work? My attempts so far have seemed to require the use of hidden fields in views to ''save'' my desired parameters for use between calls -- I don''t like this approach. Thanks for any comment, Lille -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-May-10 16:40 UTC
Re: noob question on passing parameters in the url
Lille wrote:> Hi, > > What are the requirements for passing parameters in the url across any > controller/action combinations? > > [from controller A...] redirect_to > controller_b_action1_url(:desired_param=>''desired value'') > > [now from B#1...] redirect_to > controller_b_action2_url(:desired_param=>params[:desired_param]) > > [from B#2...] redirect_to > controller_a_action2_url(:desired_param=>params[:desired_param]) > > [now from A#2...] redirect_to > controller_a_action3_url(:desired_param=>params[:desired_param]) > > Do my routes need to have only certain request actions associated, > e.g., post or put, for this to work?I believe extra URL parameters (that is, not specified in routes, but put in the query string) only work on GET.> My attempts so far have seemed to > require the use of hidden fields in views to ''save'' my desired > parameters for use between calls -- I don''t like this approach.Have you considered session variables?> > Thanks for any comment, > > LilleBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen, Thanks, I will experiment with GET and extra URL parameters. My work thus far suggests, however, this will be a difficult requirement if my goal is to pass extra URL parameters across any controller/action combination. Yes, session variables seem a natural here, but I like the idea of my users seeing the persistence of certain identifiers. I send my users through a bunch of ''test pages'' during which they might like to be reassured that the tests are being applied to the entity of interest to them, e.g., params[:id=>''1-my_entity_of_interest'']. Thanks, Lille On May 10, 12:40 pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Lille wrote: > > Hi, > > > What are the requirements for passing parameters in the url across any > > controller/action combinations? > > > [from controller A...] redirect_to > > controller_b_action1_url(:desired_param=>''desired value'') > > > [now from B#1...] redirect_to > > controller_b_action2_url(:desired_param=>params[:desired_param]) > > > [from B#2...] redirect_to > > controller_a_action2_url(:desired_param=>params[:desired_param]) > > > [now from A#2...] redirect_to > > controller_a_action3_url(:desired_param=>params[:desired_param]) > > > Do my routes need to have only certain request actions associated, > > e.g., post or put, for this to work? > > I believe extra URL parameters (that is, not specified in routes, but > put in the query string) only work on GET. > > > My attempts so far have seemed to > > require the use of hidden fields in views to ''save'' my desired > > parameters for use between calls -- I don''t like this approach. > > Have you considered session variables? > > > > > Thanks for any comment, > > > Lille > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.