Query in Loop Jan 12th, 2012 ABUSE: SQL Query in LOOP 1 2 3 <% Post.limit(10).each do |post| %> <%= post.categories.map{ |c| "<span>#{c.name}</span>"} =%> <% end %> Some operation is very EXPENSIVE Solution cache expensive operation counter_cache, memorize, cache includes find_in_batch