From: Brian Candler Date: 2012-07-31T21:34:26+09:00 Subject: Re: How to test whether a session variable has a particular key Doug Jolley wrote in post #1070702: >> are you asking a question about Rails? > > No. My question relates to CGI::Session. Looking at the source code, it's pretty icky (I'm looking at ruby 1.8.7p357, and I see for example it sets @write_lock = true at one point, but never uses it subsequently) Anyway, if you can avoid storing nil values, then I'd just use if session[:key] ... do something end As has been pointed out above, hardly anyone uses CGI these days; with any non-trivial code the overhead of loading up libraries and establishing fresh database connections is too high. Rack::Session::XXX is probably what you want. -- Posted via http://www.ruby-forum.com/.