1.On my home computer I use Webrick and I created a test controller-
-----------------------------------
class TestController < ApplicationController
def index
currentCookie = cookies['val']#read cookie
if !currentCookie
$msg = "It looks as if you haven't visited recently"
cookies['val'] = { :value => Time.now.to_s, :expires => Time.now + 360}
else
$msg = "You last visited #{cookies['val']}---- now:" + Time.now.to_s
end #if
end #index
end
----------------------------------------
and index.rhtml : <%=$msg%>
2. It works perfectly on my home computer. If I don't have any cookies, they are created and died after 1 hour.
But it doesn't work on hostingrails.com. Any idea?
And more.. On my home computer I have a file count.txt in my public folder. How to make
Webrick undestand f= File.open("count.txt", "r+") instead of f= File.open("./public/count.txt", "r+").
Thanks.