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.
90bd17e8484a3ad7db3bf0fbd276baad?d=identicon&s=25 Matt Richards (Guest)
on 2006-03-29 12: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?
F639e0cdf2fa098b535d6ec766b2aee1?d=identicon&s=25 Szymon Nowak (g0nzo)
on 2006-03-29 12: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.
858392acd1398aa6071fb1d44cc33842?d=identicon&s=25 John Smilanick (Guest)
on 2006-03-30 19: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 Smilanick
Computing Staff - Webmaster
Kavli Institute for Theoretical Physics
University of California, Santa Barbara
jsmilani@kitp.ucsb.edu
(805) 893-6307
89d967359903c639d31e4cad4569f537?d=identicon&s=25 Charlie Bowman (Guest)
on 2006-03-30 19: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 Smilanick wrote:

>
>
> > functionality,
> > --
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails

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