How to use the fixed part for the method url_for?


#1

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”)


#2

Hi,

On Feb 1, 4:54 pm, daociyiyou removed_email_address@domain.invalid 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


#3

But how to do for url_for method to generate “blog/articles/ show/1”?