Sha256: 174a69a8d9829d204d6bc3654555ed6b26df97a0e476ab19b745d4fbd0155461
Contents?: true
Size: 763 Bytes
Versions: 6
Compression:
Stored size: 763 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(password_params) 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 password_params params.require(:<%= singular_table_name %>).permit(:password, :password_confirmation) end end
Version data entries
6 entries across 6 versions & 1 rubygems