CGI Sessions

I have several Rails sites running that use sessions and they all post
cookies properly and otherwise work flawlessly. I now have need of
implementing a more raw approach to sessions using CGI::Sessions.

The Pickaxe book gives an example of how to do it (which I will append
to this message) after which they make the following statement:

This will send a cookie to the user named ``rubyweb’’ with a value of
9650. It will also create a disk file in $TMP/web-session.9650 with
the key, value pairs for CustID and Part.

Upon trying the example, I first notice that the disk file is not
named ‘session.9650’. That’s not a big deal. However, of more
importance is the fact that it fails to plant a cookie in my browser.
Apparently, this failure prevents it from knowing that a session has
been established; so, it opens a new session with each access.

Because my Rails installations do sessions so well, I conclude that
the Rails community must know something about getting this to work
that I don’t. I’m hopeful that someone here can point out the error
of my ways and I hope that my post will not be considered too far off
topic. If anyone can help me, I would deeply appreciate it. Thanks.

   ... doug

P.S. – Pickaxe Example:

<% require “cgi”
require “cgi/session”
cgi = CGI.new(“html3”)
sess = CGI::Session.new( cgi, “session_key” => “rubyweb”,
“session_id” => “9650”,
“new_session” => true,
“prefix” => “web-session.”)
sess[“CustID”] = 123
sess[“Part”] = “ABC” %>