Rails Single Table Inheritance Helper Module
Posted on March 12, 2012
Single table inheritance is a somewhat controversial topic in Rails land. For me, I like the Rails magic that it brings and, you know, the inheritance. However, it can clearly be abused. Here is my one rule for using Single table inheritance:
The models share the same data, but have differenct behavior.
I’ve created a helper module for use with Single Table Inheritance. The main advantage of this module is the factory method, with takes a type param and creates the correct object type.