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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:25:13+00:00 2026-05-16T05:25:13+00:00

I have additional variables I add to an authlogic users session like: session[:current_profile] =

  • 0

I have additional variables I add to an authlogic users session like:

session[:current_profile] = extra_id

I currently destroy these on logout in a controller like:

session[:current_profile] = nil

I’d like to clean this up and destroy them in the session model in the after_destroy method like:

def after_destroy
   session[:current_profile] = nil
end

This session method doesn’t seem to be callable from the models though. Any idea how to destroy a session variable from a model?

Thanks!

  • 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-16T05:25:13+00:00Added an answer on May 16, 2026 at 5:25 am

    You’re really not supposed to alter things in the Controller space from the Model space, which is to say, a Model should not be controlling a Controller. Models should be able to run independently of a controller, such as in unit tests where no controller is present.

    While you might be able to wrangle this sort of thing with an Observer, I don’t know of an easy way to do this. It’s probably better to have the controller perform all the required actions directly.

    If you put an after_destroy hook like this in you will have some serious side-effects if, for example, a user logged in as an admin destroys another user account and then their session profile suddenly disappears.

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

Sidebar

Related Questions

I have a PathsHelper that overwrites foo_url and foo_path by processing additional parameters as
I have a mySql query which adds certain interval of time to datetime field.
Greetings all, I've been told by co-workers that the GET method is different in
Had this question on Serverfault for a few days with no luck. I've run
Stores Table : a table to store information about different stores StoreId Name PlaceCode
I attempt to install CorePlot according to the readme file, but as soon as
I am creating an application that will take a URL as input, retrieve the
I am optimizing some code for an Intel x86 Nehalem micro-architecture using SSE intrinsics.
I need to connect to a MS SQLServer 2008 service from PHP on Ubuntu,
The following code doesn't work, I assume because the locals() variable inside the comprehension

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.