Single table inheritance. You have a class,
Document, stored in the
documents (I
know) table you have:
package Review
use Moose
extends 'Document'
The documents table has a set of columns which is the superset of attributes of Document and all its subclass and a
type column which contains the name of the class for that row.
Document->find finds Documents, Reviews and any other subclasses of document,
Review->find finds only reviews (and any subclasses).
Composed of: A way of getting round primitive obsession. You can declare something like:
composed_of :price,
:class_name => 'Money',
:mapping => %w{cents currency}
And ActiveRecord handles turning cents and currency columns into a Money object when the object is pulled out of the database breaking the price into cents and currency the the object's put back in there.
Bells and whistles: Mostly to do with declaring relationships between classes with has_many/belongs_to etc. If you want me to regurgitate the ActiveRecord::Base documentation then I will, but it's far from being the world's best documentation in the first place and my paraphrasing skills are poor. Most of the perly ORMs appear to have sensible equivalents already so it won't be beyond my wit to sort out the mapping.