diff --git a/app/controllers/settings/profiles_controller.rb b/app/controllers/settings/profiles_controller.rb index 3737f94..0787dec 100644 --- a/app/controllers/settings/profiles_controller.rb +++ b/app/controllers/settings/profiles_controller.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class Settings::ProfilesController < ApplicationController + before_action :set_account + # GET /settings/profile/edit def edit authorize %i[settings profile] @@ -10,7 +12,7 @@ class Settings::ProfilesController < ApplicationController def update authorize %i[settings profile] - unless current_account.update account_attributes_for_update + unless @account.update account_attributes_for_update return render :edit end @@ -19,6 +21,10 @@ class Settings::ProfilesController < ApplicationController private + 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, diff --git a/app/views/settings/profiles/edit.html.erb b/app/views/settings/profiles/edit.html.erb index ee9c34e..2bde651 100644 --- a/app/views/settings/profiles/edit.html.erb +++ b/app/views/settings/profiles/edit.html.erb @@ -5,7 +5,7 @@