restful paths/urls inconsistent?

Dear list,

Currently I am working on my first REST application and so far I really like te clairity it brings to the project but there is one thing I do not understand. My routes.rb looks something like this:   map.resources :projects do |projects|     projects.resources :forums, :has_many =>[:posts] do |forum|       forum.resources :topics, :name_prefix => nil do |topic|         topic.resources :posts, :name_prefix => nil         topic.resource :monitorship, :controller => :monitorships, :name_prefix => nil       end     end     projects.resources :posts, :name_prefix => 'all_', :collection => { :search => :get }   end

I was under the impression that calling fourm_path(@project, @forum) would be valid. However this is not. I need to call project_forum_path(@project, @forum). Alright I can go with that, but a little further on I want to create a edit link for a topic: edit_topic_path(@project, @forum, @topic). This works! Why? I would expect project_forum_edit_topic(@project, @forum, @topic) or edit_project_forum_topic(@project, @forum, @topic). Can someone shed some light on this?

Thanks a lot in advance! Harm

I was under the impression that calling fourm_path(@project, @forum) would be valid. However this is not. I need to call project_forum_path(@project, @forum). Alright I can go with that, but a little further on I want to create a edit link for a topic: edit_topic_path(@project, @forum, @topic). This works! Why?

Can you provide your entire routes.rb file? It certainly doesn't seem like it should work.

You set :name_prefix => nil for :topics.

Aha! That must be it. I am new to this whole REST thing and I'm continuing work on an app made by someone else. Why would you want to set :name_prefix => nil? Just to make your method names shorter? Or does it serve any other purpose?

My complete routes.rb:

ActionController::Routing::Routes.draw do |map|

  map.home '', :controller => 'projects'

  map.resources :projects do |projects|     projects.resources :project_users     projects.resources :items, :collection => 'all'     projects.resources :documents     projects.resources :links     projects.resources :chat_messages, :collection => { :show_recent => :get}     projects.resources :private_messages     projects.resources :chat_messages     projects.resources :forums, :has_many =>[:posts] do |forum|       forum.resources :topics, :name_prefix => nil do |topic|         topic.resources :posts, :name_prefix => nil         topic.resource :monitorship, :controller => :monitorships, :name_prefix => nil       end     end     projects.resources :posts, :name_prefix => 'all_', :collection => { :search => :get }   end

  map.resource :user #singleton!   map.resource :session #singleton!

  map.admin_home '/admin', :controller => 'admin/projects'   map.namespace :admin do |admin|     admin.resources :projects   end end