Search code examples
ruby-on-railssessionherokuruby-on-rails-4devise

Kill User Sessions on Devise / Heroku


I'm searching and trying for hours now, but I can't find a solution.

I need a way to kill all User Sessions so they have to log in again. I looked at the SO Answers, but somehow nothing wants to work. The most popular being:

rake db:sessions:clear

which throws a

Don't know how to build task 'db:sessions:clear'.

What am I missing, has someone a good solution for this?

What I need basically is something like a task, or console wizardry to Kill All Sessions on Devise.


Devise Session Controller

How can I reset all devise sessions so every user has to login again?


Solution

  • change the key in config/session_store.rb

    MyAppName::Application.config.session_store :cookie_store, key: '_myapp_name_session'
    

    I changed it from _myapp_name_session to _myapp_name_sessions and all users are loged out.

    reminder: Be sure to restart your server when you modify this file.