This might be a bit of an esoteric question, but I just want to know what best practices are on this issue.
Personally, I tend to avoid that for large classes for purely organisational reasons - it is easier to navigate large classes when they are separated. However, if classes are small, related (e.g. all exceptions in one file rather than in a bunch of them) or meta-generated (e.g. with eval
), then yes - they are in one file.
It depends on what kind of application you are developing and how you want your code to be structured so that it is easy to understand, document and modify.
Ruby itself does not care much about it, you can have your entire app in a single file, if you want. Rails on the contrary - due to magic loading of files based on class names.