1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/app/controllers/settings/profiles_controller.rb

32 lines
648 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Settings::ProfilesController < ApplicationController
2019-01-31 22:43:26 -05:00
before_action :set_account
# GET /settings/profile/edit
def edit
authorize %i[settings profile]
end
# PATCH/PUT /settings/profile
def update
authorize %i[settings profile]
2019-01-31 22:45:55 -05:00
return render :edit unless @account.update account_attributes_for_update
redirect_to edit_settings_profile_url
end
private
2019-01-31 22:43:26 -05:00
def set_account
@account = current_account.clone&.reload
end
def account_attributes_for_update
params.require(:account).permit(
policy(%i[settings profile]).permitted_attributes_for_update,
)
end
end