Module: ActiveRecordHas::ThroughMethods
- Defined in:
- lib/active_record_has/through_methods.rb
Instance Method Summary collapse
Instance Method Details
#arel_join_condition ⇒ Object
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_scope ⇒ Object
36 37 38 39 40 41 |
# File 'lib/active_record_has/through_methods.rb', line 36 def foreign_scope through = [:through] raise Error unless through klass.joins(through).where(arel_join_condition).select(1).except(:order) end |
#through_reflection ⇒ Object
)
26 27 28 |
# File 'lib/active_record_has/through_methods.rb', line 26 def through_reflection @through_reflection ||= active_record.reflections[[:through]&.to_s] end |