Posted almost 4 years ago. Visible to the public.

Get the root class of an ActiveRecord STI hierarchy

Use base_class.

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)

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for old versions of Ruby on Rails (3.2 and 2.3).

Owner of this card:

Avatar
Henning Koch
Last edit:
almost 4 years ago
by Henning Koch
Keywords:
inheritance
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Henning Koch to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more