Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command to clear the cookie-based session store in Rails

I often want to clear the session store in Rails, in particular, the default cookie-based session store. Some sites seem to suggest that

rake tmp:sessions:clear

accomplishes this task, but it appears that it does not. What is the proper way to clear the cookie-based session store?

like image 424
user85509 Avatar asked Aug 07 '09 05:08

user85509


Video Answer


1 Answers

If you use Cookie based sessions

You can change the secret_token of your rails app. This will invalidate all existing sessions.

rake secret

Then copy the value in to

RAILS_ROOT/config/initializers/session_store.rb

Thats it. Remember to restart your app after this ;)

If you use database based sessions

rake db:sessions:clear

If you use file based sessions

rake tmp:sessions:clear
like image 122
thekindofme Avatar answered Oct 11 '22 08:10

thekindofme