Created
July 6, 2012 13:31
-
-
Save jpowers/3060158 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SettingsController < ApplicationController | |
set_tab :settings | |
before_filter :authenticate_user! | |
def edit | |
@user = current_user | |
end | |
def update | |
@user = current_user | |
update_method = params[:user][:current_password].present? ? :update_with_password : | |
:update_without_password | |
if @user.send(update_method, params[:user]) | |
sign_in(@user, :bypass => true) | |
redirect_to root_path, :notice => "Settings updated!" | |
else | |
render :edit | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment