Sha256: 28b671da4674b391bcc425c8209f6a1e034e693cc5c643807f88da31e90aa238
Contents?: true
Size: 855 Bytes
Versions: 2
Compression:
Stored size: 855 Bytes
Contents
class PasswordsController < 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" %>) PasswordMailer.with(user: @<%= singular_table_name %>).changed.deliver_later 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(:password, :password_confirmation) end end
Version data entries
2 entries across 2 versions & 1 rubygems