(This post is to archive the information on the web for future people
searching for information.)
Ramaze's Request and Response classes are inherited from the Rack[1]
framework. Rack allows you to get and set cookies. Unfortunately, this
means that searching for methods to get and set cookies in Ramaze's
RDocs show you nothing.
To set a cookie other than in the session in Ramaze, you can use:
Ramaze::Response.current.set_cookie(
"cookie-name",
:value=>some_value,
:expires=>(Time.now +24*3600) # one day
)
(Inside a controller, you can also just use "response" to get the
current response instead of Ramaze::Response.current)
To get a cookie other than session information, you can use:
Ramaze::Request.current.cookies[ "cookie-name" ]
(Inside a controller, you can also just use "request" to get the
current request instead of Ramaze::Request.current)
Finally, to delete a cookie:
Ramaze::Response.current.delete_cookie( "cookie-name" )
[1]
rack.rubyforge.org/