Forum: Ruby setting cookies with apache eruby osx

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
63a4d720972e0adb496c67e3c0e28a0f?d=identicon&s=25 Max Benjamin (maxbenjamin)
on 2007-03-28 01:03
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

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

The program isn't throwing any errors.

On OSX, apache.
Any ideas?
Thank you
This topic is locked and can not be replied to.