mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-22 08:46:11 +01:00
Learned a better way to force an immediate load of an association (passing (true)) and applied it to the index action of the contexts and projects controller. Thanks to teferi in @nyc.rb for the assist.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@661 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
7b40b7f77c
commit
1516d7ae14
2 changed files with 3 additions and 3 deletions
|
|
@ -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.reload #reload is called here to force an immediate load so that size and empty? checks later don't result in separate SQL queries
|
||||
@contexts = current_user.contexts(true) #true is passed 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
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ class ProjectsController < ApplicationController
|
|||
session :off, :only => :index, :if => Proc.new { |req| ['rss','atom','txt'].include?(req.parameters[:format]) }
|
||||
|
||||
def index
|
||||
@projects = current_user.projects
|
||||
@contexts = current_user.contexts
|
||||
@projects = current_user.projects(true)
|
||||
@contexts = current_user.contexts(true)
|
||||
init_not_done_counts(['project'])
|
||||
if params[:only_active_with_no_next_actions]
|
||||
@projects = @projects.select { |p| p.active? && count_undone_todos(p) == 0 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue