The third alternative is to provide a common capability, but using associations
instead of inheritance. ActiveRecord has a feature called polymorphic associations that is ideal for attaching common behavior to a class without inheritance. You saw an example of a polymorphic association earlier in Address. I can use the same technique to attach my common attributes for content management instead of inheritance. Consider a class called ContentBase. Normally, to associate that class to another class, you would use a has_one relationship and a simple foreign key. But you would probably want your ContentBase to work with more than one class. You need a foreign key, and also a column that defines the type of the target class. That's exactly how ActiveRecord polymorphic associations work. Look at the classes in Listing 11.