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 def index @names=Module1::Test1.find(:all) end end
I have created module1 directory under models and written model as follows: test1.rb class Module1::Test1 < ActiveRecord::Base 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?