# Storing controllers outside of app/controllers

**URL:** <https://www.ruby-forum.com/t/storing-controllers-outside-of-app-controllers/131465>\
**Category:** Rails\
**Created:** [March 10, 2008, 1:03pm UTC](https://www.ruby-forum.com/t/storing-controllers-outside-of-app-controllers/131465 "2008-03-10T13:03:20Z")\
**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:** [March 10, 2008, 1:03pm UTC](https://www.ruby-forum.com/t/storing-controllers-outside-of-app-controllers/131465/1 "2008-03-10T13:03:20Z")

</div>

Hi All,

I’m trying to build a web application that will have an interface for  
developers to write ‘modules’ to add to the application. I’m currently  
following this structure:

app/controllers \<= The main application controllers.  
modules/controllers/ \<= Controllers for each extra module.

In config/environment.rb I’ve added the following:

config.controller\_paths \<\< “modules/controllers”

The application works fine when accessing controllers in the main  
application structure but gives an ‘Undefined Constant’ error when I  
try and access a controller in the modules directory using a URL like:  
‘[http://localhost:3000/ModuleName/Controller/Action](http://localhost:3000/ModuleName/Controller/Action)’. I am using the  
default routing.

Am I missing something really obvious? Or is there a better way of  
achieving the same thing?

Thanks,  
Rhys

---

<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:** [March 10, 2008, 1:16pm UTC](https://www.ruby-forum.com/t/storing-controllers-outside-of-app-controllers/131465/2 "2008-03-10T13:16:29Z")

</div>

On 10 Mar 2008, at 12:02, removed\_email\_address@domain.invalid wrote:

> In config/environment.rb I’ve added the following:  
> achieving the same thing?

Do you also need to add those paths to the load path ?

---

<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:** [March 12, 2008, 5:18pm UTC](https://www.ruby-forum.com/t/storing-controllers-outside-of-app-controllers/131465/3 "2008-03-12T17:18:39Z")

</div>

Ahhh, that worked. Thanks very much for that.

Rhys

On Mar 10, 12:15 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
