Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7814377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:10:33+00:00 2026-06-02T05:10:33+00:00

It seems when a user logs out via standard Devise controllers, Devise destroys the

  • 0

It seems when a user logs out via standard Devise controllers, Devise destroys the entire session store, not just its own data. Is there any way to avoid this behavior? I have other irrelevant data that should be kept around.

session[:my_var] = "123"

Log out via devise…

puts session[:my_var]
# => nil
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T05:10:34+00:00Added an answer on June 2, 2026 at 5:10 am

    The destroy¹ method of SessionsController contains the following line:

    signed_out = Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)
    

    The sign_out_all_scopes² method calls warden.logout without any arguments, and the sign_out³ method calls warden.logout(scope).

    The documentation of the logout⁴ method states:

    # Logout everyone and clear the session
    env['warden'].logout
    
    # Logout the default user but leave the rest of the session alone
    env['warden'].logout(:default)
    

    Conclusion: sign_out should preserve the session when given a specific scope. However, I don’t see any way to do that. sign_out_all_scopes is always called first, and will only return false if it couldn’t log any user out.

    I recommend either posting a feature request on their issue tracker or developing your own authentication solution. Rails now provides has_secure_password, and these days people seem to be going for the latter in order to avoid running into these problems.


    ¹ Devise::SessionsController#destroy

    ² Devise::Controllers::Helpers#sign_out_all_scopes

    ³ Devise::Controllers::Helpers#sign_out

    ⁴ Warden::Proxy#logout

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ajax seems to give a better user experience, but I'm not so sure if
It seems that Visual Basic can not reference sheets according to user-modified sheet names.
It seems to me that Response.Cache.SetVaryByCustom(mykey); is not working from within ASCX User Controls.
Let the user write/draw a character on the canvas,and recognize it. Seems not so
I'm using Forms authentication. I have a small problem after the user logs out.
Seems to me for simple forms that only require the user to ensure a
The CollapsiblePanelExtender seems primarily designed to collapse/expand things in response to user mouse events.
Seems simple enough. I'm creating a search engine that returns results to the user
It seems like buttons and links are interchangeable these days. From a user-experience perspective,
When opening a client against a db40 server it seems to expect a user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.