Grouping Controllers into Modules - Doesn't work!?

Ok, what I want to achieve is:

http:///admin/products

calls app/controllers/admin/products_controller.rb

According to Agile Development with Rails this should work.

I executed the follwing commands:

rails myproj
cd myproj
script/generate controller Admin
script/generate scaffold Admin::Product

this creates app/controllers/admin/products_controller.rb all the views
& Product model, but doesnt actually route.

http:///admin/products just gives me:

Unknown action
No action responded to product

Any ideas?

You (probably) can’t have admin controller, because it’s the name of
your group.
If you want all your admin controllers have some common functionality,
you can create admin_base controller (its name has to be different than
‘admin’) and inherit all your admin controllers from this one.

I don’t know if there’s any difference, but you can do Admin/Product
instead of Admin::Product.

I am trying to do the same thing, but I am not sure I want urls to
look like: /admin/base/index
Are there any decent alternatives?

-John


John S.
Computing Staff - Webmaster
Kavli Institute for Theoretical Physics
University of California, Santa Barbara
[email protected]
(805) 893-6307

You can edit your routes.rb to make your urls look any way you want.

On Thu, 2006-03-30 at 09:22 -0800, John S. wrote:

functionality,

[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Charlie B.
Programmer
Castle Branch Inc.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs