If i have the following routes: ############### map.connect "blog/:controller/:action/:id" map.connect "product/:controller/:action/:id" ############## when use url_for or some else to generate the url,how to make sure that url_for use the first route to generate the url "blog/articles/ show/1" ? what to add to the url_for(:controller=>"articles",:action=>"show",:id=>"1") ? like this? url_for (:controller=>"articles",:action=>"show",:id=>"1",:anchor=>"blog") --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thomas R. Koll
2009-Feb-01 16:05 UTC
Re: how to use the fixed part for the method url_for?
Hi, On Feb 1, 4:54 pm, daociyiyou <chey...-/E1597aS9LRv1O+Z8WTAqQ@public.gmane.org> wrote:> If i have the following routes: > ############### > map.connect "blog/:controller/:action/:id" > map.connect "product/:controller/:action/:id" > ############## > when use url_for or some else to generate the url,how to make sure > that url_for use the first route to generate the url "blog/articles/ > show/1" ? > what to add to the > url_for(:controller=>"articles",:action=>"show",:id=>"1") ? > like this? > url_for > (:controller=>"articles",:action=>"show",:id=>"1",:anchor=>"blog")Why not use this route: map.resources :articles, :as => ''blog'' Then you can call article_path(@article) For all routes that map.resources creates do a ''rake routes'' on the console. ciao, tom -- Thomas R. "TomK32" Koll <> http://ananasblau.com just a geek trying to change the world http://github.com/TomK32 --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
But how to do for url_for method to generate "blog/articles/ show/1"? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---