1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Refactor build_joins to use select_association_list

This commit is contained in:
Ryuta Kamizono 2020-05-17 20:54:57 +09:00
parent 838d3f73dd
commit c0c53ee9d2

View file

@ -1160,7 +1160,7 @@ module ActiveRecord
when ActiveRecord::Associations::JoinDependency when ActiveRecord::Associations::JoinDependency
stashed_joins&.<< association stashed_joins&.<< association
else else
yield if block_given? yield association if block_given?
end end
end end
result result
@ -1211,13 +1211,8 @@ module ActiveRecord
end end
end end
joins.each do |join| buckets[:association_join] = select_association_list(joins, buckets[:stashed_join]) do |join|
case join if join.is_a?(Arel::Nodes::Join)
when Hash, Symbol, Array
buckets[:association_join] << join
when ActiveRecord::Associations::JoinDependency
buckets[:stashed_join] << join
when Arel::Nodes::Join
buckets[:join_node] << join buckets[:join_node] << join
else else
raise "unknown class: %s" % join.class.name raise "unknown class: %s" % join.class.name