Podle „Session stub & a bug“, Szabolcs Szasz <sz@szasz.hu>
Minimální .rhtml
dokument pro sezení (session)
Příklad 42.1. Minimální session .rhtml
<% require 'cgi/session' session = CGI::Session.new( cgi = CGI.new('html4') ) begin session['var'] = 'xxx' # You WILL use sessions from mod_ruby, so don't forget this # for closing it (ie. closing the session-file, by default). # See: http://www.modruby.net/doc/faq.en.html#label:14 ensure cgi.header # *NASTY* hack to flush stuff to actually make the # session live -- needed only for creating a session # Any nicer way, please?? (I DO NOT want to # clutter my "main stuff" (above) with cgi.calls, as # I only need sessions, and conceptually, CGI has # nothing to do with that. I want a clean page ...) session.close end %>
mod_ruby je možno získat v archívu na http://www.modruby.net/archive/ a aktuální vývojovou verzi je možno získat z cvs
následujícím postupem:
$export CVSROOT=:pserver:anonymous@cvs.ruby-lang.org:/src
$cvs login
Logging in to :pserver:anonymous@cvs.ruby-lang.org:2401/srcCVS password:
anonymous
$cvs checkout mod_ruby