Session destroy callback?

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

Wes G. 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.