instance method polymorphic_class_for

Ruby on Rails 6.1.7.10

Since v6.1.7.10

Available in: v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

polymorphic_class_for(name)

Returns the class for the provided name.

It is used to find the class correspondent to the value stored in the polymorphic type column.

Parameters

name req
Source
# File activerecord/lib/active_record/inheritance.rb, line 197
      def polymorphic_class_for(name)
        if store_full_class_name
          ActiveSupport::Dependencies.constantize(name)
        else
          compute_type(name)
        end
      end

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

Defined in ActiveRecord::Inheritance::ClassMethods

Type at least 2 characters to search.

↑↓ navigate · open · esc close