Is there a way to set a cookie with CGI::Cookie objects, from an rhtml file?

I’m trying this with cgi.out, but it doesn’t like me doing that without
a body. There must be a way to print the cookie header from the cookie
object so I can send it out from the top of my .rhtml file, but it
doesn’t seem to be obvious how you’d do this.

xc

Xeno C. wrote:

Xeno C. wrote:
How do I set a cookie from a .rhtml file?
I’ve got myself a CGI::Cookie object, so I just need to print out the
Set-Cookie header, but there must be an appropriate way to do this in
eruby.
When I try cgi.out(“cookie” => cookie) it demands a body.
Presumably there is a method in eruby for handling this very very common
case???
I can see just printing the Set-Cookie: prefix with the output from
cookie.to_s, but how do I know it comes at the right point in the HTTP
header set?