# Organizing controllers and models

**URL:** <https://discuss.rubyonrails.org/t/organizing-controllers-and-models/26544>\
**Category:** rubyonrails-talk\
**Created:** [March 19, 2008, 8:14am UTC](https://discuss.rubyonrails.org/t/organizing-controllers-and-models/26544 "2008-03-19T08:14:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [March 19, 2008, 8:14am UTC](https://discuss.rubyonrails.org/t/organizing-controllers-and-models/26544/1 "2008-03-19T08:14:11Z")

</div>

What can be the ways to organize Controllers and Models into proper hierarchy? This is essential, as in my application, there are 3-4 controller and 5-6 models corresponding to one service. And there can be hundreads of service added later on. If I am putting all the contollers and models in the same directory, it will become very bulky and even there may be name conflicts. So I organized it under different directories under the controllers and models. I created module1 directory under controllers and written controller as follows.

test1\_controller.rb class Module1::Test1Controller \< ApplicationController &nbsp;&nbsp;def index &nbsp;&nbsp;&nbsp;&nbsp;@names=Module1::Test1.find(:all) &nbsp;&nbsp;end end

I have created module1 directory under models and written model as follows: test1.rb class Module1::Test1 \< ActiveRecord::Base &nbsp;&nbsp;self.table\_name='module1\_test1s' end

I have to specify table name in every model, otherwise it looks for test1s table only. Is there any way to get rid of this? I havent tried implementing association,I think it may create problem in that also.

Or is there any cleaner way to do it using rails?

Regards Dharmarth
