module ActiveRecord::Associations::ThroughAssociation

def through_reflection

def through_reflection
  @through_reflection ||= begin
    refl = reflection.through_reflection
    while refl.through_reflection?
      refl = refl.through_reflection
    end
    refl
  end
end