Should be a simple solution for this: I have: <%= link_to "Add Address", order_new_addressbook_path(@order) %> which generates <a href="/orders/23222/addressbooks/new">Add Address</a> I want to pass in additional parameters, yet cant figure out where to put them. The end result URL that I''m looking for is: <a href="/orders/23222/addressbooks/new?address_type=2">Add Address</a> so... where do I put the :address_type => 2 part? :-) Thanks! -- Posted via 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 groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6/29/07, Dave Coleman <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Should be a simple solution for this: > > I have: > <%= link_to "Add Address", order_new_addressbook_path(@order) %> > which generates > <a href="/orders/23222/addressbooks/new">Add Address</a> > > I want to pass in additional parameters, yet cant figure out where to > put them. The end result URL that I''m looking for is: > > <a href="/orders/23222/addressbooks/new?address_type=2">Add Address</a> > > so... where do I put the :address_type => 2 part? :-) > > Thanks!I''d like to know this one too. What I''ve done in that past is pass the named route a hash. order_new_addressbook_path( :order_id => @order_id, :address_type => 2 ) But I don''t like having to supply specifically the :order_id part but I can''t seem to get it working otherwise. Cheers Daniel --~--~---------~--~----~------------~-------~--~----~ 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 groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 28, 2007, at 10:16 PM, Dave Coleman wrote:> Should be a simple solution for this: > > I have: > <%= link_to "Add Address", order_new_addressbook_path(@order) %> > which generates > <a href="/orders/23222/addressbooks/new">Add Address</a> > > I want to pass in additional parameters, yet cant figure out where to > put them. The end result URL that I''m looking for is: > > <a href="/orders/23222/addressbooks/new?address_type=2">Add > Address</a> > > so... where do I put the :address_type => 2 part? :-) > > Thanks!order_new_addressbook_path(:order => @order, :address_type => 2) You have to use the hash options form to provide additional parameters for the query string of the URL. -Rob Rob Biedenharn Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org agileconsultingllc.com -------------------------- "I sort of keep hoping that red herrings will steadilly come along, to keep people busy; I get secret satisfaction when bad ideas take hold and suck a lot of people in ... like Java." -- Don Knuth, Things a Computer Scientist Rarely Talks About, p.16 (Stanford, California: CSLI Publications, 2001) --~--~---------~--~----~------------~-------~--~----~ 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 groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> order_new_addressbook_path(:order => @order, :address_type => 2) > > You have to use the hash options form to provide additional > parameters for the query string of the URL. >Rob, Daniel''s example worked, yours did not. Did you mean to say order_id? Thanks for the quick reply! -- Posted via 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 groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 28, 2007, at 10:32 PM, Dave Coleman wrote:>> order_new_addressbook_path(:order => @order, :address_type => 2) >> >> You have to use the hash options form to provide additional >> parameters for the query string of the URL. >> > > Rob, Daniel''s example worked, yours did not. > Did you mean to say order_id? > > Thanks for the quick reply!Yes, of course I did! (just want to make sure you were paying attention ;-) -Rob Rob Biedenharn Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org agileconsultingllc.com -------------------------- "I sort of keep hoping that red herrings will steadilly come along, to keep people busy; I get secret satisfaction when bad ideas take hold and suck a lot of people in ... like Java." -- Don Knuth, Things a Computer Scientist Rarely Talks About, p.16 (Stanford, California: CSLI Publications, 2001) --~--~---------~--~----~------------~-------~--~----~ 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 groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---