On Mon, 27 Nov 2006, Alan F. wrote:
This lets me have /story/1/comments or /story/1/comment/3.
Is this allowed ? Can I map the same resource into two different
The thing is, when you call resources, you create methods called
comments_url, comment_url, etc. So if you create those methods twice,
the second set take precedence.
There are a couple of things you can do. One is [untested so tweak if
I’ve mistyped it]:
map.resources :stories do |story|
story.resources :comments, :name_prefix => “inner_”
Now you’ll have:
You can also add the :name_prefix to the plain comments resources, if
you’d rather have it work that way.
Another thing you can do – but be warned; it’s very experimental, and
also may or may not suit your schema – is use my Inferred Routes
plugin. This allows you to do just the nested route, and then when
the plugin will infer:
You can get the plugin at:
David A. Black | [email protected]
Author of “Ruby for Rails”  | Ruby/Rails training & consultancy 
DABlog (DAB’s Weblog)  | Co-director, Ruby Central, Inc. 
 Ruby for Rails |  http://www.rubypowerandlight.com
 http://dablog.rubypal.com |  http://www.rubycentral.org