Get the root class of an ActiveRecord STI hierarchy

Use base_class Show archive.org snapshot .

This traverses up the hierarchy until it encounters either

  • a class inheriting from ActiveRecord::Base or
  • a class inheriting from an abstract class (inheriting from ActiveRecord::Base)
Henning Koch