An esoteric incident in Ruby onrails6
User features created with devise I made a function to edit passwords and email addresses When I update my edits, I get logged out.
It seems that it was properly listed in the rails guidebook! It seems that if you edit the password or email address by default, you will be logged out.
How to solve this? .. .. ..
user.controller.rb
def edit
@user=User.find(params[:id])
end
def update
@user = User.find(params[:id])
if @user.update(user_params)
bypass_sign_in(@user) #Describe this! !! !! !! !! !! !! !!
else
render 'edit'
end
end
By adding the code described in the comment out I succeeded in resolving this case. : sunny:
Wow Wow: shamrock:
Recommended Posts