提交 76172228 编写于 作者: A Aaron Patterson

only do the should_reset test once

上级 b4aae5a8
......@@ -27,15 +27,15 @@ def associated_records_by_owner
through_records = owners.map do |owner, h|
association = owner.association through_reflection.name
x = [owner, Array(association.reader)]
# Dont cache the association - we would only be caching a subset
association.reset if should_reset
[owner, Array(association.reader), association]
end
x
# Dont cache the association - we would only be caching a subset
if should_reset
through_records.each { |(_,_,assoc)| assoc.reset }
end
middle_records = through_records.map { |(_,rec)| rec }.flatten
middle_records = through_records.map { |(_,rec,_)| rec }.flatten
preloader = Preloader.new(middle_records,
source_reflection.name,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册