Forum: Ruby on Rails Grouping Controllers into Modules - Doesn't work!?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Matt Richards (Guest)
on 2006-03-29 14:02
Ok, what I want to achieve is:

http://<mydomain>/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://<mydomain>/admin/products just gives me:

Unknown action
No action responded to product

Any ideas?
Szymon N. (Guest)
on 2006-03-29 14:45
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.
John S. (Guest)
on 2006-03-30 21:26
(Received via mailing list)
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
removed_email_address@domain.invalid
(805) 893-6307
Charlie B. (Guest)
on 2006-03-30 21:32
(Received via mailing list)
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,
> > --
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails

Charlie B.
Programmer
Castle Branch Inc.
This topic is locked and can not be replied to.