module ActiveRecord::Mti

Multiple Table Inheritance (MTI)

Say, you have a base model (Fruit) and its implementations (Apple & Banana). STI is not suitable because you have to keep Apple's & Banana's specific fields in one table (fruits). MTI enables you to keep a clear database schema with a table for common fields only (fruits) and two tables for specific fields only (apples & bananas). This implementation is based on delegation pattern and doesn't use class inheritance.

Example:

class Fruit < ActiveRecord::Base
  mti_base
end

class Apple < ActiveRecord::Base
  mti_implementation_of :fruit
end

class Banana < ActiveRecord::Base
  mti_implementation_of :fruit
end