Forum: Ruby Retrieving session data from a cookie

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Doug J. (Guest)
on 2009-02-20 22:26
The pick-axe book describes a method for retrieving cookie-based session
data from within a cgi script.  It works fine from within a cgi script.
What I would really like to know is how I can accomplish this feat of
retrieving the same data from within embedded Ruby.  Can anyone help me
out on this one?  Thanks for any input.  FWIW, I'm appending what the
pick-axe book has to say about doing it from a cgi script.  Thanks for
any input.

      ... doug

Pick Axe Book:

require "cgi"
require "cgi/session"

cgi = CGI.new("html3")
sess = CGI::Session.new( cgi, "session_key" => "rubyweb",
                               "prefix" => "web-session.")
cgi.out{
  cgi.html{
    "\nCustomer #{sess['CustID']} orders an #{sess['Part']}"
  }
}
This topic is locked and can not be replied to.