Read more

Inherit without Single-Table-Inheritance (STI) in ActiveRecord

Henning Koch
May 14, 2013Software engineer at makandra GmbH

You have multiple options:

  1. Just don't have a type column. All STI magic will be disabled automatically.
  2. If you have a type column but want to use it for something else (WAT?), you can set self.inheritance_column = :_non_existing_column in the class definition
  3. (Untested) In the parent class, set self.abstract_class = true
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

This technique is useful to implement form models / presenters, where you want all the goodness of ActiveRecord but want to add additional logic for a particular screen (e.g. class SignUp < User).

Posted by Henning Koch to makandra dev (2013-05-14 11:56)