Nested controller and RESTful routes
Posted by Sandro Paganotti in
Ruby on Rails -
comments are closed
Today I tried to use map.resource function within a nested controller, well my first attempt wasn’t really that successful, I tried with this code:
map.resources :projects, :controller => "planning/projects" do |projects|
projects.resources :resources, :controller => "planning/resources"
end
end
But I obtained a routing error while trying to point the browser to ‘planning/projects’ so, the working solution I found is:
map.resources :projects, :controller => "planning/projects", :path_prefix => "/planning" do |projects|
projects.resources :resources, :controller => "planning/resources"
end
end
By using the path_prefix option everything worked fine :-)
Sandro

