Sha256: a331565eecc470f08e9fa258992a192646fba9cec54c868b0ed90189e6df48bf
Contents?: true
Size: 928 Bytes
Versions: 1
Compression:
Stored size: 928 Bytes
Contents
class EmailsController < ApplicationController before_action :set_<%= singular_table_name %> def update if !@<%= singular_table_name %>.authenticate(params[:current_password]) render json: { error: "The current password you entered is incorrect" }, status: :bad_request elsif @<%= singular_table_name %>.update(<%= "#{singular_table_name}_params" %>) if @<%= singular_table_name %>.email_previously_changed? EmailMailer.with(email_change: @<%= singular_table_name %>.email_previous_change).changed.deliver_later end render json: @<%= singular_table_name %> else render json: @<%= singular_table_name %>.errors, 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(:email) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
authentication-zero-0.0.14 | lib/generators/authentication/templates/controllers/api/emails_controller.rb.tt |