Chatwoot/app/controllers/api/v1/profiles_controller.rb
Sojan Jose 8c52a3a953
Chore: Remove duplication of user JBuilder (#911)
* Chore: Reduce duplication of user JBuilder
2020-05-31 23:10:20 +05:30

21 lines
423 B
Ruby

class Api::V1::ProfilesController < Api::BaseController
before_action :set_user
def show
render partial: 'api/v1/models/user.json.jbuilder', locals: { resource: @user }
end
def update
@user.update!(profile_params)
end
private
def set_user
@user = current_user
end
def profile_params
params.require(:profile).permit(:email, :name, :password, :password_confirmation, :avatar)
end
end