Forum: Ruby on Rails nested resources with nested controllers

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
15824f90bc5965a827abb340523a2519?d=identicon&s=25 crzivn (Guest)
on 2007-01-10 21:09
(Received via mailing list)
Is there a way to create resources that work with nested controllers?
For example:

./script/generate scaffold_resource project name:string
mkdir app/views/layouts/project         # so the command below doesn't
./script/generate scaffold_resource project::user name:string

# routes.rb
map.resources :projects do |project|
  project.resources :users

After creating a project and trying to list it's users by using
/projects/1/users it will give the error:

Processing ApplicationController#index (for at 2007-01-10
20:31:39) [GET]
  Session ID: effe3a9a1b3131e75c4507fc92eb01d5
  Parameters: {"project_id"=>"1", "action"=>"index",

NameError (uninitialized constant UsersController):
# etc

Looking in rails/railties/lib/rails_generator/generators/compon
ents/scaffold_resource/scaffold_resource_generator.rb there seems to be
some logic for nesting controllers but I can't figure out how it is
supposed to be used.
This topic is locked and can not be replied to.