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

Remove useless JoinInformation

Since 213796f removed `binds`, `JoinInformation` only contain `joins`.
So it is enough to return `joins` simply.
This commit is contained in:
Ryuta Kamizono 2017-07-25 18:55:03 +09:00
parent d9ca57ab0b
commit ea37a5709b
3 changed files with 5 additions and 10 deletions

View file

@ -174,9 +174,9 @@ module ActiveRecord
def make_join_constraints(parent, child, join_type, aliasing = false)
tables = aliasing ? table_aliases_for(parent, child) : child.tables
info = make_constraints(parent, child, tables, join_type)
joins = make_constraints(parent, child, tables, join_type)
[info] + child.children.flat_map { |c| make_join_constraints(child, c, join_type, aliasing) }
joins.concat child.children.flat_map { |c| make_join_constraints(child, c, join_type, aliasing) }
end
def table_aliases_for(parent, node)

View file

@ -23,8 +23,6 @@ module ActiveRecord
super && reflection == other.reflection
end
JoinInformation = Struct.new :joins
def join_constraints(foreign_table, foreign_klass, join_type, tables, chain)
joins = []
tables = tables.reverse
@ -51,7 +49,7 @@ module ActiveRecord
foreign_table, foreign_klass = table, klass
end
JoinInformation.new joins
joins
end
def table

View file

@ -1014,11 +1014,8 @@ module ActiveRecord
klass, table, association_joins, join_list
)
join_infos = join_dependency.join_constraints stashed_association_joins, join_type
join_infos.each do |info|
info.joins.each { |join| manager.from(join) }
end
joins = join_dependency.join_constraints(stashed_association_joins, join_type)
joins.each { |join| manager.from(join) }
manager.join_sources.concat(join_list)