Class: UsersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



4
5
# File 'app/controllers/users_controller.rb', line 4

def show
end

#updateObject



7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/users_controller.rb', line 7

def update
  unless @user.authenticate(user_params[:current_password])
    @user.errors.add(:current_password, :wrong_password)
    return render :show
  end
  unless @user.update_attributes(user_params)
    return render :show
  end
  session[:succeed_password] = user_params[:password]
  redirect_to user_path
end