Sha256: dbb64cf275cc9f7abeeaf61204b383a53b4167f9485565b74489b8b2677cf2a2
Contents?: true
Size: 772 Bytes
Versions: 9
Compression:
Stored size: 772 Bytes
Contents
class EmailsController < ApplicationController before_action :set_<%= singular_table_name %> def edit end def update if !@<%= singular_table_name %>.authenticate(params[:current_password]) redirect_to edit_email_path, alert: "The current password you entered is incorrect" elsif @<%= singular_table_name %>.update(<%= "#{singular_table_name}_params" %>) redirect_to root_path, notice: "Your email 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.require(:<%= singular_table_name %>).permit(:email) end end
Version data entries
9 entries across 9 versions & 1 rubygems