Forced an earlier load of a user's contexts on the contexts listing page so that calls to size and empty? don't result in additional SQL queries.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@660 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-11-26 03:19:58 +00:00
parent 584fdf2d34
commit 7b40b7f77c

View file

@ -10,7 +10,7 @@ class ContextsController < ApplicationController
session :off, :only => :index, :if => Proc.new { |req| ['rss','atom','txt'].include?(req.parameters[:format]) }
def index
@contexts = current_user.contexts
@contexts = current_user.contexts.reload #reload is called here to force an immediate load so that size and empty? checks later don't result in separate SQL queries
init_not_done_counts(['context'])
respond_to do |format|
format.html &render_contexts_html