class ActiveRecord::Associations::JoinDependency

Private Instance Methods

table_aliases_for(parent, node) click to toggle source
# File lib/duty_free.rb, line 381
def table_aliases_for(parent, node)
  node.reflection.chain.map do |reflection|
    alias_tracker.aliased_table_for(
      reflection.table_name,
      table_alias_for(reflection, parent, reflection != node.reflection)
    ).tap do |x|
      # %%% Specific only to Rails 4.2 (and maybe 4.1?)
      x = x.left if x.is_a?(Arel::Nodes::TableAlias)
      y = reflection.chain.find { |c| c.table_name == x.name }
      x.instance_variable_set(:@_arel_table_type, y.klass)
    end
  end
end