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

Ask A Question

Stats

  • Questions 499k
  • Answers 499k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer var nums = new int?[] {1, null, 3}; var total… May 16, 2026 at 12:43 pm
  • Editorial Team
    Editorial Team added an answer <style type="text/css"> .clear{ clear: both; } .top{ width: 100%; }… May 16, 2026 at 12:43 pm
  • Editorial Team
    Editorial Team added an answer Their algorithms aren't officially released to the public, but if… May 16, 2026 at 12:43 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have created a function in PHP that calls a webservice and parses through
I am a new Ruby on Rails user and had a question. I have
first, I can't stand Crystal! Okay, that's off my chest... Now, we have an
I am not strong on my PHP knowledge, but I have never seen this
I have two files. main.py that has main program logic and functions.py that has
I have seen the example here . All well and good and I understand
I am creating a new build process for a DotNet project which is to
For quite a simple table structure, ie. Person, Criteria, and PersonCriteria (the combi-table), I
Custom metadata in Actionscript classes are very cool. You can put anything in square
I'm at a loss to explain what seems to be mis-addressing within the char[]

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.