I am using eruby/mod_ruby on a website I am developing. Everything is going fine and dandy with the site development (as it pertains to ruby), but I can't get my hand on session management.
I have never had to do session management before, so this is all new to me.
I tried doing the example from the Pragmatic Programmers online ruby book, but it doesn't seem to work. Here is the code:
test.rhtml<<
equire "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"
cgi.out{
cgi.html{
"\nHTML content here"
}
}
test2.rhtml<<
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']}"
}
}
I visit test.rhtml, I see "HTML Content Here" as exected.
I visit test2.rhtml then, I get "Customer orders an", note I do NOT get the CustID or Part printed
I revisit test.rhtml, and it stalls (ie "I get Opening page...." and it keeps waiting, nothing happens.)
First of all, why, when I first visited test2.rhtml, did I not see the stored info?
And secondly, why can I no longer visit either test.rhtml or test2.rhtml once visited once ... it just never finishes loading (both IE and Firebird, even after clearing my cookies and cache). Thanks.
ยทยทยท
_________________________________________________________________
Getting married? Find great tips, tools and the latest trends at MSN Life Events. http://lifeevents.msn.com/category.aspx?cid=married