module Polyamorous::JoinDependencyExtensions::ClassMethods

Public Instance Methods

walk_tree(associations, hash) click to toggle source

Prepended before ActiveRecord::Associations::JoinDependency#walk_tree

Calls superclass method
# File lib/polyamorous/activerecord_5.2_ruby_2/join_dependency.rb, line 58
def walk_tree(associations, hash)
  case associations
  when TreeNode
    associations.add_to_tree(hash)
  when Hash
    associations.each do |k, v|
      cache =
        if TreeNode === k
          k.add_to_tree(hash)
        else
          hash[k] ||= {}
        end
      walk_tree(v, cache)
    end
  else
    super(associations, hash)
  end
end