Save valid attributes with ignoring the invalid ones (#12633)
* add save_valid_attributes method in profile * undo save_valid_attributes method * Render the settings page with user entered params incase of failed update
This commit is contained in:
parent
aca08cfb11
commit
0911cd4a5c
1 changed files with 7 additions and 1 deletions
|
|
@ -6,10 +6,16 @@ class ProfilesController < ApplicationController
|
|||
update_result = Profiles::Update.call(current_user, update_params)
|
||||
if update_result.success?
|
||||
flash[:settings_notice] = "Your profile has been updated"
|
||||
redirect_to user_settings_path
|
||||
else
|
||||
@user = current_user
|
||||
@tab = "profile"
|
||||
flash[:error] = "Error: #{update_result.errors_as_sentence}"
|
||||
render template: "users/edit", locals: {
|
||||
user: update_params[:user],
|
||||
profile: update_params[:profile]
|
||||
}
|
||||
end
|
||||
redirect_to user_settings_path
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue