Controller Naming Question

Is it possible to have controllers named the following?
/admin
/admin/user

If not, is there some way to get it to work with routes?

I want to have some actions at the url /admin/ and some at
/admin/user/ (obviously in admin/user controller).

Thanks!!!

On Mar 14, 2006, at 9:56 AM, Chris B. wrote:

Is it possible to have controllers named the following?
/admin
/admin/user

If not, is there some way to get it to work with routes?

I want to have some actions at the url /admin/ and some at
/admin/user/ (obviously in admin/user controller).

See the following for a good write-up on this…

http://justinfrench.com/index.php?id=122

-S

On 3/14/06, Chris B. [email protected] wrote:

Is it possible to have controllers named the following?
/admin
/admin/user

Sure. The first controller would be named Admin and the second one
Admin::User, actually a User controller class inside a module named
Admin.

However, just naming them correctly won’t do, the default routing
mechanism will interpret /admin/user as the action ‘user’ from the
controller ‘admin’. You can achieve what you want by tweaking your
routes, make sure to add something like this on the top of the
routes.rb file (it needs to be on top, so it matches at a higher
priority than the default route):


map.connect ‘admin/user/:action’,
:controller => ‘admin/user’

Good luck,

Thiago A.