Since yesterday, I asked many of my Rails friends the same question:
How can I put many classes in one file in a Rails app?
Unfortunately, I haven't got any answer that would work.
I try to solve this problem every 6 months or so. It's not a thing that I can't live without, but it would help my workflow a lot.
One use case is to put 4-5 model classes in one file. If each class is only 15 lines and they're all conceptually related then why not to put them together?
Another use case is to keep related controllers in one file.
So far I tried a combination of require, require_dependency and autoload and I tried to put them in config/initializers, environment.rb or in application_controller. Each resulted in some kind of error. Either one of the class was not found, or Rails complained with "A copy of ApplicationController has been removed from the module tree but is still active!".
I tried all of it with Rails 2.3.5 in development mode, however a solution that works with Rails 3 would also be great!
Can anyone help?