Bruno Sousa wrote:
> I got this file to a apache/mod-ruby server and nothing is being set to
> "lastaccess"
> 
> test.rhtml:
> <%
> require 'cgi'
> require 'cgi/session'
> cgi = CGI.new("html4")
> 
> sess = CGI::Session.new( cgi, "session_key" => "a_test",
>                               "prefix" => "rubysess.")
> lastaccess = sess["lastaccess"].to_s
> sess["lastaccess"] = Time.now
> if cgi['bgcolor'][0] =~ /[a-z]/
>   sess["bgcolor"] = cgi['bgcolor']
> end
> 
> cgi.out{
>   cgi.html {
>     cgi.body ("bgcolor" => sess["bgcolor"]){
>       "The background of this page"    +
>       "changes based on the 'bgcolor'" +
>       "each user has in session."      +
>       "Last access time: #{lastaccess}"
>     }
>   }
> }
> %>
> 
> 
> What can be happenning?

A first access cannot have a lastaccess?

Also:

result = "hello"[0]
puts result

if result =~ /h/
  puts 'yes'
else
  puts 'no'
end

--output:--
104
no

-- 
Posted via http://www.ruby-forum.com/.