Before I go off on a tangent, I thought it best to see if anyone has a
pattern for this already.
An example should explain all:
Let’s say I have a Person class and a person can be both a Teacher and
a Performer. I feel that Teacher and Performer are classes in their
own right as they have other things associated with them. Including
all attributes and associations under the User class will get real
messy, real quick.
At first I experimented with STI but obviously a class can only be one
I could also use standard associations and have this kind of set up:
person = Person.find(1)
This could prove to be the most straight-foward way of doing it, but I
can’t help feeling that the definitions aren’t representative of the
domain - and that kinda bothers me.
I feel like saying “a Person can be a Teacher and/or a Performer”…
Anyway, I’d be very interested in anyone’s thoughts on this. If there
is a pattern out there for this that would apply to ActiveRecord then
I’m poised to code it up.