| Class | Sequel::Plugins::ManyThroughMany::ManyThroughManyAssociationReflection |
| In: |
lib/sequel/plugins/many_through_many.rb
|
| Parent: | Sequel::Model::Associations::ManyToManyAssociationReflection |
The AssociationReflection subclass for many_through_many associations.
The table containing the column to use for the associated key when eagerly loading
# File lib/sequel/plugins/many_through_many.rb, line 51
51: def associated_key_table
52: self[:associated_key_table] = self[:final_reverse_edge][:alias]
53: end
The default associated key alias(es) to use when eager loading associations via eager.
# File lib/sequel/plugins/many_through_many.rb, line 57
57: def default_associated_key_alias
58: self[:uses_left_composite_keys] ? (0...self[:through].first[:left].length).map{|i| "x_foreign_key_#{i}_x""x_foreign_key_#{i}_x"} : :x_foreign_key_x
59: end
The hash key to use for the eager loading predicate (left side of IN (1, 2, 3))
# File lib/sequel/plugins/many_through_many.rb, line 62
62: def eager_loading_predicate_key
63: self[:eager_loading_predicate_key] ||= begin
64: calculate_edges
65: e = self[:edges].first
66: f = self[:final_reverse_edge]
67: qualify(f[:alias], e[:right])
68: end
69: end
The list of joins to use when eager graphing
# File lib/sequel/plugins/many_through_many.rb, line 72
72: def edges
73: self[:edges] || calculate_edges || self[:edges]
74: end
Many through many associations don‘t have a reciprocal
# File lib/sequel/plugins/many_through_many.rb, line 77
77: def reciprocal
78: nil
79: end