Class: Joiner::JoinDependency

Inherits:
ActiveRecord::Associations::JoinDependency
  • Object
show all
Defined in:
lib/joiner/join_dependency.rb

Instance Method Summary collapse

Instance Method Details

#join_association_for(path, alias_tracker = nil) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/joiner/join_dependency.rb', line 2

def join_association_for(path, alias_tracker = nil)
  @alias_tracker = alias_tracker
  construct_tables! join_root

  path.inject(join_root) do |node, piece|
    node.children.detect { |child| child.reflection.name == piece }
  end
end