No need to patch `make_constraints`, apparently

This method changes a lot in Rails 6.1. If we can rely on Rails
version, everything is easier.
This commit is contained in:
David Rodríguez 2020-11-24 10:10:43 +01:00
parent e1be118369
commit cbe52b1627
No known key found for this signature in database
GPG Key ID: 1008A258BB37309C
1 changed files with 0 additions and 7 deletions

View File

@ -45,13 +45,6 @@ module Polyamorous
end
private
def make_constraints(parent, child, join_type = Arel::Nodes::OuterJoin)
foreign_table = parent.table
foreign_klass = parent.base_klass
join_type = child.join_type || join_type if join_type == Arel::Nodes::InnerJoin
joins = child.join_constraints(foreign_table, foreign_klass, join_type, alias_tracker)
joins.concat child.children.flat_map { |c| make_constraints(child, c, join_type) }
end
module ClassMethods
# Prepended before ActiveRecord::Associations::JoinDependency#walk_tree