# "Nesting" Controllers

**URL:** <https://www.ruby-forum.com/t/nesting-controllers/115452>\
**Category:** Rails\
**Created:** [September 25, 2007, 2:12pm UTC](https://www.ruby-forum.com/t/nesting-controllers/115452 "2007-09-25T14:12:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [September 25, 2007, 2:12pm UTC](https://www.ruby-forum.com/t/nesting-controllers/115452/1 "2007-09-25T14:12:20Z")

</div>

Hi there!

I guess this is a pretty noob-like question for all the long-aged  
railers.

I’d like to keep the controllers for my admin interface inside a folder  
called (guess…) “admin”. I wonder if I could make rails notice this  
and let me do “admin/:controller/…” without having to make a route for  
each controller.

~Chris

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [September 26, 2007, 5:24pm UTC](https://www.ruby-forum.com/t/nesting-controllers/115452/2 "2007-09-26T17:24:32Z")

</div>

Chris H. wrote:

> I’d like to keep the controllers for my admin interface inside a folder  
> called (guess…) “admin”. I wonder if I could make rails notice this  
> and let me do “admin/:controller/…” without having to make a route for  
> each controller.

Yup that works fine. All the controller in admin should be in the admin  
module (ie Admin::MyController).  
if you ruby script/generate admin/foo it will do it for you

Fred
