How to empty/destroy a session in rails?

tybro0103 picture tybro0103 · Mar 9, 2010 · Viewed 112.5k times · Source

I can't seem to find it anywhere... How do I delete/destroy/reset/empty/clear a user's session in Rails? Not just one value but the whole thing..

Answer

Gdeglin picture Gdeglin · Mar 9, 2010

To clear the whole thing use the reset_session method in a controller.

reset_session

Here's the documentation on this method: http://api.rubyonrails.org/classes/ActionController/Base.html#M000668

Resets the session by clearing out all the objects stored within and initializing a new session object.

Good luck!