Sha256: ed7dee796f95f4a7c2960ef2fa7e4932e4ac3f0e2c536b4ff8b7642c83186611
Contents?: true
Size: 844 Bytes
Versions: 7
Compression:
Stored size: 844 Bytes
Contents
class PasswordsController < ApplicationController before_action :set_<%= singular_table_name %> def edit @<%= singular_table_name %> = Current.<%= singular_table_name %> end def update if !@<%= singular_table_name %>.authenticate(params[:current_password]) redirect_to password_edit_path, alert: "The current password you entered is incorrect" elsif @<%= singular_table_name %>.update(password_params) redirect_to root_path, notice: "Your password has been changed successfully" else render :edit, status: :unprocessable_entity end end private def set_<%= singular_table_name %> @<%= singular_table_name %> = Current.<%= singular_table_name %> end def password_params params.require(:<%= singular_table_name %>).permit(:password, :password_confirmation) end end
Version data entries
7 entries across 7 versions & 1 rubygems