From 7b40b7f77c9ae1b4d58def0387b48b3aff9cee93 Mon Sep 17 00:00:00 2001 From: lukemelia Date: Mon, 26 Nov 2007 03:19:58 +0000 Subject: [PATCH] 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 --- tracks/app/controllers/contexts_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tracks/app/controllers/contexts_controller.rb b/tracks/app/controllers/contexts_controller.rb index bf3c4dce..8efcce47 100644 --- a/tracks/app/controllers/contexts_controller.rb +++ b/tracks/app/controllers/contexts_controller.rb @@ -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