# Namespaces that are controllers?

**URL:** <https://www.ruby-forum.com/t/namespaces-that-are-controllers/185576>\
**Category:** Rails\
**Created:** [March 23, 2010, 1:56am UTC](https://www.ruby-forum.com/t/namespaces-that-are-controllers/185576 "2010-03-23T01:56:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjand](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3e96dc/32.png) [@mjand](https://www.ruby-forum.com/u/mjand)\
**Post date:** [March 23, 2010, 1:56am UTC](https://www.ruby-forum.com/t/namespaces-that-are-controllers/185576/1 "2010-03-23T01:56:35Z")

</div>

I’m checking out the new router in Rails 3, and was looking to create  
an ‘/admin’ section of a website with several namespaced resources,  
however I’d like the top level ‘/admin’ to also route to a  
controller. Here’s my current setup:

match ‘admin’ =\> ‘admin#index’, :as =\> ‘admin’  
namespace :admin do  
resources :users  
resources :roles  
end

It seems to work fine, however I get the feeling that there is a  
better way (perhaps a block on the ‘match’). Is that the ‘best’ way  
to have ‘/admin’ respond with a page?

Thanks,  
-Mike
