class BabySqueel::Join

This is the thing that gets added to Active Record's joins_values. By including Polyamorous::TreeNode, when this instance is found when traversing joins in ActiveRecord::Associations::JoinDependency::walk_tree, Join#add_to_tree will be called.

Public Class Methods

new(associations) click to toggle source
# File lib/baby_squeel/join.rb, line 9
def initialize(associations)
  @associations = associations
end

Public Instance Methods

add_to_tree(hash) click to toggle source

Each individual association object knows how to build a Polyamorous::Join. Those joins will be added to the hash incrementally.

# File lib/baby_squeel/join.rb, line 16
def add_to_tree(hash)
  @associations.inject(hash) do |acc, assoc|
    assoc.add_to_tree(acc)
  end
end