Class: ActiveRecord::Associations::BelongsToPolymorphicAssociation

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

Overview

Active Record Belongs To Polymorphic Association

Instance Attribute Summary

Attributes inherited from Association

#inversed, #owner, #reflection, #target

Instance Method Summary collapse

Methods inherited from BelongsToAssociation

#decrement_counters, #default, #handle_dependency, #increment_counters, #replace, #reset, #target=, #updated?

Methods inherited from SingularAssociation

#build, #force_reload_reader, #reader, #writer

Methods inherited from Association

#association_scope, #create, #create!, #extensions, #initialize, #initialize_attributes, #load_target, #loaded!, #loaded?, #marshal_dump, #marshal_load, #reload, #remove_inverse_instance, #reset, #reset_scope, #scope, #set_inverse_instance, #stale_target?, #target_scope

Constructor Details

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

Instance Method Details

#klassObject

:nodoc:



7
8
9
10
# File 'lib/active_record/associations/belongs_to_polymorphic_association.rb', line 7

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