Skip to content

Commit 36d7bd1

Browse files
committed
stop creating intermediate AR objects, just construct AR objects from a list of hashes
1 parent 84f81f5 commit 36d7bd1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

activerecord/lib/active_record/relation/finder_methods.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ def exists?(id = nil)
188188
def find_with_associations
189189
including = (@eager_load_values + @includes_values).uniq
190190
join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, including, [])
191-
rows = construct_relation_for_association_find(join_dependency).to_a
191+
relation = construct_relation_for_association_find(join_dependency)
192+
rows = connection.exec_query(relation.to_sql, 'SQL', relation.bind_values)
192193
join_dependency.instantiate(rows)
193194
rescue ThrowResult
194195
[]

0 commit comments

Comments
 (0)