Re: session destroy callback?

Alex Wayne
Tue, 28 Nov 2006 08:14:31 -0000

Wes Gamble wrote:
> All.
>
> Is there a method that we can define/override that is guaranteed to be
> called whenever a session is destroyed (regardless of how it is
> destroyed)?
>
> Thanks,
> Wes

Sort of, but not really.  If you are using ActiveRecordStore you can add
a before_destroy method to your Session model, but you have to delete
the entries with a session_obj.destroy call.  If you have a cronjob that
simply runs a

  DELETE FROM sessions WHERE updated_at < (*some_time_ago*)

Then there is no callback, because rails never gets invoked at all.

The problem is that most methods of session cleanup happen without the
rails app even knowing it happened at all.

--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---