Class: ActiveRecord::Associations::BelongsToPolymorphicAssociation

Inherits:
BelongsToAssociation show all
Defined in:
activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Association

#owner, #reflection, #target

Instance Method Summary collapse

Methods inherited from BelongsToAssociation

#replace, #updated?

Methods inherited from SingularAssociation

#build, #create, #create!, #reader, #writer

Methods inherited from Association

#aliased_table_name, #association_scope, #initialize, #interpolate, #load_target, #loaded!, #loaded?, #reload, #reset, #reset_scope, #scoped, #set_inverse_instance, #stale_target?, #target_scope

Constructor Details

This class inherits a constructor from ActiveRecord::Associations::Association

Instance Method Details

#klassObject



5
6
7
8
# File 'activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb', line 5

def klass
  type = owner[reflection.foreign_type]
  type.presence && type.constantize
end