Module: Hickey::DomainDetector::HasOneThroughAssociation

Defined in:
lib/hickey/domain_detector/associations.rb

Instance Method Summary collapse

Instance Method Details

#has_one_through(owner, reflection, attr_value) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/hickey/domain_detector/associations.rb', line 26

def has_one_through(owner, reflection, attr_value)
  through_reflection = reflection.through_reflection
  Proc.new do
    target = attr_value.accept_for_hickey(reflection.klass, self)
    association = ActiveRecord::Associations::HasOneThroughAssociation.new(owner, reflection).send(:construct_join_attributes, target)
    association.accept_for_hickey(through_reflection.klass, self)
  end
end