mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-01 02:20:16 +01:00
Introduce current_user and prefs accessors that replace the @user and @prefs variables that were being used in most places.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@575 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
ad5fbc7147
commit
30c23fc560
18 changed files with 233 additions and 207 deletions
|
|
@ -2,20 +2,18 @@ class PreferencesController < ApplicationController
|
|||
|
||||
def index
|
||||
@page_title = "TRACKS::Preferences"
|
||||
@prefs = @user.preference
|
||||
@prefs = prefs
|
||||
end
|
||||
|
||||
def edit
|
||||
@page_title = "TRACKS::Edit Preferences"
|
||||
@prefs = @user.preference
|
||||
|
||||
render :object => @prefs
|
||||
render :object => prefs
|
||||
end
|
||||
|
||||
def update
|
||||
user_success = @user.update_attributes(params['user'])
|
||||
prefs_success = @user.preference.update_attributes(params['prefs'])
|
||||
if user_success && prefs_success
|
||||
user_updated = current_user.update_attributes(params['user'])
|
||||
prefs_updated = current_user.preference.update_attributes(params['prefs'])
|
||||
if user_updated && prefs_updated
|
||||
redirect_to :action => 'index'
|
||||
else
|
||||
render :action => 'edit'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue