Forum: Ruby on Rails session data

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Dave M. (Guest)
on 2007-03-07 01:30
I have a major headache.

I have a complete set of data from a database table and I have deleted
all of the contents from the table, DON'T ASK.

I need to recover the data.

The data is stored in the session hash and I have to retrieve it.

The problem is I cannot find a way to iterate through the session.
Trying "session.each do..." doesn't work, neither does "session.keys".

Any help out there for a DESPERATE final year student in a bit of a fix.

Humbly yours dave.
Chris H. (Guest)
on 2007-03-07 18:44
(Received via mailing list)
from the console

$ script/console

>> Marshal.load(Base64.decode64(ActiveRecord::Base.connection.select_one("select
* from sessions where session_id = '<your session id

it should return a hash of all the data stored in the session.

hope that helps
Dave M. (Guest)
on 2007-03-09 01:26
Chris H. wrote:

You're a superstar Chris. That pulled me out of hole.

But of course, that's what the session table holds! Don't know why I
didn't see it. Doh!

Many many thanks,
This topic is locked and can not be replied to.