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 7437955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:28:44+00:00 2026-05-29T10:28:44+00:00

My Devise/Warden-based app stores a model ID in the session[] variable. I want destroy

  • 0

My Devise/Warden-based app stores a model ID in the session[] variable. I want destroy the object when the session[] is destroyed.

  • Is there a callback or some mechanism to notify my app when the session is destroyed?
  • Is the mechanism dependable, or should I run a nightly cleanup script to vacuum up any orphaned objects?

To make it clear, here’s a snippet of my controller code:

class WizardsController < ApplicationController
  before_filter :find_or_create_wizard
  ...
private

  def find_or_create_wizard
    @wizard = Wizard.find_by_id(session[:wizard_id]) || Wizard.create.tap {|w| session[:wizard_id] = w }
  end

end

To restate the question: how and when should I destroy the Wizard object?

  • 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-05-29T10:28:45+00:00Added an answer on May 29, 2026 at 10:28 am
    Warden::Manager.before_logout do |user,auth,opts| 
      # callback 
    end 
    

    Use the Warden::Hooks https://github.com/hassox/warden/blob/master/lib/warden/hooks.rb to do things after sign out or authentication.

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

Sidebar

Related Questions

Devise, the authentication gem for Ruby based on Warden (another auth gem) does not
I'm using devise with my rails 3 app. For some reason the sign in
Does anyone had installed Devise gem with Sinatra? Devise is based on Warden and
I want to stub out a logged in user (with Devise/Warden) using rspec mocks
I have a rails app that is using Devise, with a User model, no
I'm having some difficulties in testing devise with shoulda: 2) Error: test: handle :index
I see in the config/initializers/devise.rb, there is a configuration called config.stretches. # ==> Configuration
I've recently just added Devise to my first Rails3 app, and I'm having a
I see plenty that lead to custom authorization strategies for devise and warden, but
Devise works perfectly in my app except for flash messages from devise.en.yml doesn't get

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.