changed flash thing

This commit is contained in:
nilsding 2014-12-29 14:54:32 +01:00
parent 3e033cc102
commit e7a0d77fd4
1 changed files with 5 additions and 1 deletions

View File

@ -16,7 +16,11 @@ class UserController < ApplicationController
def update
user_attributes = params.require(:user).permit(:display_name, :profile_picture, :motivation_header, :website,
:location, :bio, :crop_x, :crop_y, :crop_w, :crop_h)
unless current_user.update_attributes(user_attributes)
if current_user.update_attributes(user_attributes)
text = 'Your profile has been updated!'
text += ' It might take a few minutes until your new profile picture is shown everywhere.' if user_attributes[:profile_picture]
flash[:success] = text
else
flash[:error] = 'An error occurred. ;_;'
end
redirect_to edit_user_profile_path