Well, Iβm sure that if you run session.delete(:hash_name) , which destroys the session, however, it is strongly recommended not to try to create your own authentication system, especially if you need time to create the simplest functionality, while a ready-made solution can be installed in 20 minutes. Not only this, but the turnkey solution is probably twice as secure as anything you can prepare yourself, because it has been tested and tested by many developers.
I highly recommend using an authentication program. Using the method, you get methods such as sign_out(current_user) , which, obviously, gives the user a query. Take a look at the github page
All that is required is a gem install devise , add it to your gemfile and run
rails g devise:install User # or whatever model name
And they handle the rest
OneChillDude
source share