Module: ActiveRecordHas::ThroughMethods

Defined in:
lib/active_record_has/through_methods.rb

Instance Method Summary collapse

Instance Method Details

#arel_join_conditionObject

Raises:



30
31
32
33
34
# File 'lib/active_record_has/through_methods.rb', line 30

def arel_join_condition
  raise Error unless through_reflection

  through_reflection.arel_join_condition
end

#foreign_scopeObject

Raises:



36
37
38
39
40
41
# File 'lib/active_record_has/through_methods.rb', line 36

def foreign_scope
  through = options[:through]
  raise Error unless through

  klass.joins(through).where(arel_join_condition).select(1).except(:order)
end

#through_reflectionObject

)



26
27
28
# File 'lib/active_record_has/through_methods.rb', line 26

def through_reflection
  @through_reflection ||= active_record.reflections[options[:through]&.to_s]
end