Reputation: 4475
How should we separate models into sub directories? 100+ tables.
For example, for contract, there are
app/models/contract/contract.rb
app/models/contract/contract_signer.rb
class Contract::Contract < ActiveRecord::Base
end
class Contract::ContractSigner < ActiveRecord::Base
end
I dislike it!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Upvotes: 0
Views: 379
Reputation: 21690
We've got around 130 models here and are organizing them just as you said - except we're using Contract::Base
from time to time. I recommend Contract::Contract
and Contract::Signer
here.
Upvotes: 0
Reputation: 51697
If you want to organize your models using directories, this is perfectly normal. You will need to add this directory to your load path in environment.rb.
The only thing that looks a little odd are your class names. Why don't you just use:
class Contract < ActiveRecord::Base
end
class ContractSigner < ActiveRecord::Base
end
Upvotes: 1