diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2013-05-11 00:34:25 -0400 |
---|---|---|
committer | Neeraj Singh <neerajdotname@gmail.com> | 2013-06-19 04:09:43 +0530 |
commit | 2b73f780ffa52baba09511b2db753f0fde574c14 (patch) | |
tree | 8948c673b922e14008623dfb7d27692d5fa18d5b /activerecord/lib/active_record/counter_cache.rb | |
parent | 353a398bee68c5ea99d76ac7601de0a5fef6f4a5 (diff) | |
download | rails-2b73f780ffa52baba09511b2db753f0fde574c14.tar.gz rails-2b73f780ffa52baba09511b2db753f0fde574c14.tar.bz2 rails-2b73f780ffa52baba09511b2db753f0fde574c14.zip |
do not load all child records for inverse case
currently `post.comments.find(Comment.first.id)` would load all
comments for the given post to set the inverse association.
This has a huge performance penalty. Because if post has 100k
records and all these 100k records would be loaded in memory
even though the comment id was supplied.
Fix is to use in-memory records only if loaded? is true. Otherwise
load the records using full sql.
Fixes #10509
Diffstat (limited to 'activerecord/lib/active_record/counter_cache.rb')
0 files changed, 0 insertions, 0 deletions