Gathered up calls to init and init_todos in before_filters, as suggested by <a href="http://www.therailsway.com/2006/11/16/tracks-part-2">Part 2</a> of the RailsWay article series.

There are a couple of test errors that I can't seem to fix. 

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@363 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2006-11-26 12:13:48 +00:00
parent ad6616d161
commit 9c37b40f3d
5 changed files with 9 additions and 23 deletions

View file

@ -3,6 +3,8 @@ class ContextController < ApplicationController
helper :todo
prepend_before_filter :login_required
before_filter :init, :except => [:create, :destroy, :order]
before_filter :init_todos, :only => :show
layout "standard", :except => :date_preview
def index
@ -14,7 +16,6 @@ class ContextController < ApplicationController
# Set page title, and collect existing contexts in @contexts
#
def list
self.init
@page_title = "TRACKS::List Contexts"
respond_to do |wants|
wants.html
@ -26,9 +27,6 @@ class ContextController < ApplicationController
# e.g. <home>/context/<context_name> shows just <context_name>.
#
def show
init
check_user_set_context
init_todos
@page_title = "TRACKS::Context: #{@context.name}"
end
@ -64,7 +62,6 @@ class ContextController < ApplicationController
# Edit the details of the context
#
def update
self.init
check_user_set_context
params['context'] ||= {}
success_text = if params['field'] == 'name' && params['value']