Class: SimpleMaster::ActiveRecord::BelongsToPolymorphicAssociation

Inherits:
ActiveRecord::Associations::BelongsToPolymorphicAssociation
  • Object
show all
Defined in:
lib/simple_master/active_record/belongs_to_polymorphic_association.rb

Instance Method Summary collapse

Instance Method Details

#find_target(async: false) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/simple_master/active_record/belongs_to_polymorphic_association.rb', line 6

def find_target(async: false)
  klass = klass()
  if klass < Master
    foreign_key = owner.send(reflection.foreign_key)
    klass.find(foreign_key)
  else
    super
  end
end