def make_polyamorous_left_outer_joins(parent, child)
      tables    = child.tables
      join_type = Arel::Nodes::OuterJoin
      info      = make_constraints parent, child, tables, join_type

      info + child.children.flat_map { |c|
        make_polyamorous_left_outer_joins(child, c)
      }
    end
def make_polyamorous_left_outer_joins(parent, child)
      tables    = child.tables
      join_type = Arel::Nodes::OuterJoin
      info      = make_constraints parent, child, tables, join_type

      info + child.children.flat_map { |c|
        make_polyamorous_left_outer_joins(child, c)
      }
    end
Replaces ActiveRecord::Associations::JoinDependency#make_left_outer_joins,
 a new method that was added in Rails 5.0 with the following commit:
 https://github.com/rails/rails/commit/e038975