[RUBY] Rails6 Couldn't find User with'id' = sign_out and cannot log out

error contents

スクリーンショット 2020-09-22 13.02.47.png

Reference article

https://qiita.com/chisaki0606/items/f1f03a6c226e49b5f7b3

I can't log out

A situation occurs in which the logout that should have been possible until now suddenly becomes impossible. I spent a day with this error, so I decided to post this article in the hope that it would help people with similar errors.

Solution

As per the reference article

config/initializers/devise.rb


config.sign_out_via = :delete

Is changed as follows.

config/initializers/devise.rb


config.sign_out_via = :get

However, logging out again does not resolve the error. This is because the code in devise.rb will not be reflected until you restart, so it will remain an error as it is. for that reason,

$ rails s 

You need to access `` `localhost: 3000``` again. By doing so, you can escape from the error and log out normally.

At the end

The last reboot is important and I haven't done this so I'm addicted to the swamp. I hope it helps people who are suffering from similar errors. Also, if there is an error in the description, I would appreciate it if you could point it out.

Recommended Posts

Rails6 Couldn't find User with'id' = sign_out and cannot log out
[Ruby on Rails] Error that Couldn't find User with ... after logging out
Rails Posts and User Linkage
[Rails] Couldn't find with'id'=: id does not execute update action
[Rails] [ActiveStorage] Find out if a particular user has an avatar
[Rails] Difference between find and find_by
Find out about instance methods and self
Find out about Rails hidden_field (create a confirmation screen and check the behavior)