instance method inheritance_column

Ruby on Rails 6.0.6

Since v3.2.22.5 Last seen in v6.1.7.10

Available in: v3.2.22.5 v4.0.13 v4.1.16 v4.2.9 v5.2.8.1 v6.0.6 v6.1.7.10

Signature

inheritance_column()

Defines the name of the table column which will store the class name on single-table inheritance situations.

The default inheritance column name is type, which means it’s a reserved word inside Active Record. To be able to use single-table inheritance with another column name, or to use the column type in your own model for something else, you can set inheritance_column:

self.inheritance_column = 'zoink'
Source
# File activerecord/lib/active_record/model_schema.rb, line 268
      def inheritance_column
        (@inheritance_column ||= nil) || superclass.inheritance_column
      end

Defined in activerecord/lib/active_record/model_schema.rb line 268 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ModelSchema::ClassMethods

Type at least 2 characters to search.

↑↓ navigate · open · esc close