Get the root class of an ActiveRecord STI hierarchy

Posted . Visible to the public.

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
Last edit
Henning Koch
Keywords
inheritance
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2015-08-12 09:46)