Hi you all, I have a link with two params: <%= link_to "John Smith", { :action => "filtered_list", :value => "John Smith", :property=> "primaryCharacter" }, :post => true %> The URL appears as: /wiki/filtered_list?value=John+Smith&property=primaryCharacter My question is, could I get another style in the link, such as: /wiki/filtered_list/John+Smith/primaryCharacter (I mean, in the same way as when we use :id param) Or even hide the params on the url? (this could be eventually done by using a form with hidden fields, but this is not my idea...) -- 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 -~----------~----~----~----~------~----~------~--~---
You should be able to do this in your routes: map.connect ''/wiki/filtered_list/:value/:property'', :controller => ''wiki'', :action => ''filtered_list'' The url should then be formatted as per your question. This is just off the top of my head and could likely be improved on, but it should give the idea. Hope that helps, Steve --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Damaris Fuentes wrote:> > Hi you all, > I have a link with two params: > <%= link_to "John Smith", { :action => "filtered_list", :value => "John > Smith", :property=> "primaryCharacter" }, :post => true %> > > The URL appears as: > /wiki/filtered_list?value=John+Smith&property=primaryCharacter > > My question is, could I get another style in the link, such as: > /wiki/filtered_list/John+Smith/primaryCharacter > (I mean, in the same way as when we use :id param) > > Or even hide the params on the url? (this could be eventually done by > using a form with hidden fields, but this is not my idea...) >Damaris, edit routes.rb in config to cutomize how your URL''s would look, for example: map.connect "wiki/:action/:value/:property", :controller => ''your_controller'' hope that helps, Bojan -- Bojan Mihelac Informatika Mihelac, Bojan Mihelac s.p. | www.informatikamihelac.com -> tools, scripts, tricks from our code lab: http://source.mihelac.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Sure, in routes.rb... map.connect ''/wiki/filtered_list/:value/:property, :controller => ''wiki'', :action => ''filtered_list'' You could also do something like this... map.connect ''/wiki/list/:value/:property, :controller => ''wiki'', :action => ''filtered_list'' In other words, the URL doesn''t have to match the controller or action names. -- Building an e-commerce site with Rails? http://www.agilewebdevelopment.com/rails-ecommerce On Jan 15, 2007, at 6:12 AM, Damaris Fuentes wrote:> > Hi you all, > I have a link with two params: > <%= link_to "John Smith", { :action => "filtered_list", :value => > "John > Smith", :property=> "primaryCharacter" }, :post => true %> > > The URL appears as: > /wiki/filtered_list?value=John+Smith&property=primaryCharacter > > My question is, could I get another style in the link, such as: > /wiki/filtered_list/John+Smith/primaryCharacter > (I mean, in the same way as when we use :id param) > > Or even hide the params on the url? (this could be eventually done by > using a form with hidden fields, but this is not my idea...) > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Wow! Thanks all of you! :D -- 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 -~----------~----~----~----~------~----~------~--~---