I'm working on a project for a local charity to track donors, donations, assets, and a few other things. They would like the ability to attach files/documents to all of their records.
Do I have to setup database tables and models for each of my models or is there some way to have a generic document class that can belong_to anything?
In other words, rather than setting up donor_documents, donation_documents, and asset_documents, is there some way I can set up a single documents model???
You want a polymorphic model... and that does exactly what you're talking about. look in the docs for has_many and the polymporphic section.