Help, things are getting too flat

Well this is sort of a philosophical question about agile best practices in Rails. I'm working on a content management system which is to be the website of a university academic department. It's module-based, so a page author can drag a calendar onto the page, then a course description, then a faculty bio, etc. So far so good.

I have in fact been developing in what I think is an agile way, adding layers of functionality one iteration at a time and then refactoring.

At first I created basic (polymorphic) module framework and one type of module which could be added to pages. Worked well and everything was elegant.

Now I'm going through and creating the models for the rest of the module types. The problem is that even basic things like describing the relationship between instructors and courses requires several tables and models. Which is fine, except my list of tables, migrations, and models is becoming really unwieldy from a development point of view-- i.e. the file lists in my IDE are just long, and in alphabetical order rather than any conceptual or inheritance-based hierarchy. This is starting to bog me down, as the complexity of this iteration seems to have increased exponentially. When I'm working on the calendar functionality or developing the models for it, I'd rather not have to stare at the half-dozen models and tables that relate to instructors. It'd be cool if I could encapsulate all the models relating to calendars, into some kind of calendar package (and even similarly organize database tables and migrations).

Is there a Rails solution or best practice for this? A way to organize things more hierarchically, to create groups of related models, or of related database tables and/or migrations?

Or is this an inevitable side-effect of Rails's emphasis on the "relational" rather than the "object" in ORM? I do enjoy the advantages of that approach, but am also starting to see its disadvantage as well-- its flatness.

Should I just keep it flat like this and use another (UMLish) tool to keep track of the hierarchies?

Thanks for any advice

Is there a Rails solution or best practice for this? A way to organize things more hierarchically, to create groups of related models, or of related database tables and/or migrations?

I haven't tried this myself, but apparently you can put your model class files into subdirectories (app/models/foo/user.rb, app/models/bar/page.rb, etc.), and Rails will still find them (without having to use explicit package names). Of course you'd have to be careful about not using the same model name twice. I also don't know if this is a bug or a feature.

- Hendrik

Thanks, this works and has eased my pain. Any other suggestions welcome.