mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #21033 from dgynn/preloader_build_scope_tuning
Skip _select! call unless needed for preloader
This commit is contained in:
commit
f854be5e64
1 changed files with 3 additions and 1 deletions
|
@ -137,7 +137,9 @@ module ActiveRecord
|
|||
scope.where_clause = reflection_scope.where_clause + preload_scope.where_clause
|
||||
scope.references_values = Array(values[:references]) + Array(preload_values[:references])
|
||||
|
||||
scope._select! preload_values[:select] || values[:select] || table[Arel.star]
|
||||
if preload_values[:select] || values[:select]
|
||||
scope._select!(preload_values[:select] || values[:select])
|
||||
end
|
||||
scope.includes! preload_values[:includes] || values[:includes]
|
||||
if preload_scope.joins_values.any?
|
||||
scope.joins!(preload_scope.joins_values)
|
||||
|
|
Loading…
Reference in a new issue