comment.rb
5.49 KB
-
Use proper relations instead of forcefully loading relations by hand. · a89ce191
Some of the ways comments are accessed in the User model (when a complete user object is requested) lead to an N+1 situation because while we preload the related documents (preloading the parent thread of a given comment, in this case), further accesses to those comments actually never take advantage of the preloaded relations. We should be using the relation directly, which will still act the same as before but allow us to actually benefit from preloading.
Toby Lawrence committed