mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-12 10:24:22 +01:00
Cleaned up some more unnecessary ActiveRecord calls in the ProjectsController and ContextsController.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@529 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
472db2f586
commit
2ff03c573e
3 changed files with 31 additions and 25 deletions
|
|
@ -2,7 +2,7 @@ class ContextsController < ApplicationController
|
|||
|
||||
helper :todos
|
||||
|
||||
before_filter :init, :except => [:create, :destroy, :order]
|
||||
before_filter :init, :except => [:index, :create, :destroy, :order]
|
||||
before_filter :init_todos, :only => :show
|
||||
before_filter :set_context_from_params, :only => [:update, :destroy]
|
||||
skip_before_filter :login_required, :only => [:index]
|
||||
|
|
@ -10,6 +10,8 @@ class ContextsController < ApplicationController
|
|||
session :off, :only => :index, :if => Proc.new { |req| ['rss','atom','txt'].include?(req.parameters[:format]) }
|
||||
|
||||
def index
|
||||
@contexts = @user.contexts
|
||||
init_not_done_counts(['context'])
|
||||
respond_to do |format|
|
||||
format.html &render_contexts_html
|
||||
format.xml { render :xml => @contexts.to_xml( :except => :user_id ) }
|
||||
|
|
@ -131,8 +133,6 @@ class ContextsController < ApplicationController
|
|||
# if the user sets the preference for them to be shown
|
||||
# @projects = @user.projects.reject { |x| x.completed? }
|
||||
init_data_for_sidebar
|
||||
@todos = @user.todos
|
||||
@done = @user.todos.find_in_state(:all, :completed, :order => "todos.completed_at DESC")
|
||||
end
|
||||
|
||||
def init_todos
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue