instance method
polymorphic_class_for
Ruby on Rails 7.1.6
Since v6.1.7.10Signature
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
-
namereq
Source
# File activerecord/lib/active_record/inheritance.rb, line 216
def polymorphic_class_for(name)
if store_full_class_name
name.constantize
else
compute_type(name)
end
end
Defined in activerecord/lib/active_record/inheritance.rb line 216
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Inheritance::ClassMethods