# Packaging controllers in Rails

**URL:** <https://www.ruby-forum.com/t/packaging-controllers-in-rails/121174>\
**Category:** Rails\
**Created:** [November 24, 2007, 10:17pm UTC](https://www.ruby-forum.com/t/packaging-controllers-in-rails/121174 "2007-11-24T22:17:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 24, 2007, 10:17pm UTC](https://www.ruby-forum.com/t/packaging-controllers-in-rails/121174/1 "2007-11-24T22:17:33Z")

</div>

Hey all,

```
I am just starting to learn rails, and I was curious to know if it

```

is possible to set up folder systems within the apps/controller area?  
Our application is beginning to become quite large, and we would  
really like to package/organize controllers together in separate  
folders for maintainability…

Thanks,

Mitch Gillespie

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 24, 2007, 10:32pm UTC](https://www.ruby-forum.com/t/packaging-controllers-in-rails/121174/2 "2007-11-24T22:32:46Z")

</div>

Sorry… just to provide an example this is what we’re looking to  
accomplish…

app/controllers/questions  
app/controllers/sections  
app/controllers/answers  
app/controllers/questions/question1\_controller.rb  
app/controllers/questions/question2\_controller.rb  
… and so on…

We’re positive the change will be in the routes.rb file… but were  
just not 100% sure how to accomplish it.

Thanks,

On Nov 24, 4:17 pm, “removed\_email\_address@domain.invalid”

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 25, 2007, 12:04am UTC](https://www.ruby-forum.com/t/packaging-controllers-in-rails/121174/3 "2007-11-25T00:04:36Z")

</div>

On 24 Nov 2007, at 21:32, removed\_email\_address@domain.invalid wrote:

> 

You can do stuff like

app/controllers/foo  
app/controllers/foo/question\_controller.rb  
app/controllers/bar  
app/controllers/foo/answer\_controller.rb

And in answer\_controller.rb you define Foo::AnswerController  
You’ll get this automatically if you run ruby script/generate foo/  
answer

Fred
