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