From 4df74d6ff52edd3d809ee8a8c5eb6629374faa6e Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Sun, 17 Dec 2023 22:58:25 +0100 Subject: [PATCH] Ensure errors display when updating profile images --- app/controllers/settings/profile_picture_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/settings/profile_picture_controller.rb b/app/controllers/settings/profile_picture_controller.rb index c44e1200..68359fe7 100644 --- a/app/controllers/settings/profile_picture_controller.rb +++ b/app/controllers/settings/profile_picture_controller.rb @@ -12,9 +12,10 @@ class Settings::ProfilePictureController < ApplicationController text += t(".notice.profile_header") if user_attributes[:profile_header] flash[:success] = text else - flash[:error] = t(".error") + # CarrierWave resets the image to the default upon an error + current_user.reload end - redirect_to settings_profile_path + render "settings/profile/edit" end end