attribute base_class
Ruby on Rails edge
Since v7.0.10Returns the first class in the inheritance hierarchy that descends from either an abstract class or from ActiveRecord::Base.
Consider the following behavior:
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
class Shape < ApplicationRecord
self.abstract_class = true
end
Polygon = Class.new(Shape)
Square = Class.new(Polygon)
ApplicationRecord.base_class # => ApplicationRecord
Shape.base_class # => Shape
Polygon.base_class # => Polygon
Square.base_class # => Polygon