Forum: Ruby on Rails how to use the fixed part for the method url_for?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
669c735cf55efa005140fa232b05c4f6?d=identicon&s=25 daociyiyou (Guest)
on 2009-02-01 16:55
(Received via mailing list)
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")
978ed7ca309d5495078702096f9add03?d=identicon&s=25 Thomas r. Koll (tomk32)
on 2009-02-01 17:05
(Received via mailing list)
Hi,

On Feb 1, 4:54 pm, daociyiyou <chey...@yahoo.com.cn> wrote:
> 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
669c735cf55efa005140fa232b05c4f6?d=identicon&s=25 daociyiyou (Guest)
on 2009-02-01 18:02
(Received via mailing list)
But how to do for url_for method to  generate "blog/articles/ show/1"?
This topic is locked and can not be replied to.