Skip to content

Instantly share code, notes, and snippets.

@jpowers
Created July 6, 2012 13:31
Show Gist options
  • Save jpowers/3060158 to your computer and use it in GitHub Desktop.
Save jpowers/3060158 to your computer and use it in GitHub Desktop.
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