setting cookies with apache eruby osx

M

Max Benjamin

Hi list,
I'm attempting to write a simple web app in ruby that uses cookies. I
can't seem to get the program to set a cookie on the users browser. I'm
testing my "cookie setting ability" with this script from the Pragmatic
Guide:

<%
COOKIE_NAME = 'chocolate chip'
require 'cgi'
cgi = CGI.new
value = cgi.cookies[COOKIE_NAME]
if value.empty?
msg = "It looks like you haven't visited recently"
else
msg = "You last visited #{values[0]}"
end
cookie = CGI::Cookie.new(COOKIE_NAME, Time.now.to_s)
cookie.expires = Time.now + 30*24*3600
cgi.out("cookie" => cookie){msg}
%>

The program isn't throwing any errors.

On OSX, apache.
Any ideas?
Please...
Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top