Skip to Navigation | Skip to Content



Rails Cookie Gotchas | June 19th, 2007

Rails breaks the hash implementation that cookies appear, on the surface, to support.

For whatever reason, symbol access of values doesn’t work but string access does. Also, for whatever reason, the nil? method will not work but the empty? method does. Hopefully this saves somebody some frustration!


request.cookies['note'].value unless request.cookies['note'].empty?

Cookies, yum.

Posted in Uncategorized | | Add to Delicious | Digg It

This entry was posted on Tuesday, June 19th, 2007 at 3:42 pm and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “Rails Cookie Gotchas”

  1. SeanG Says:

    Yes!! This did help me very much!! I was stuck on this part of my application, and it was taking me a while to figure out why.

    I also didn’t know about the .value method for the cookie.

    Thanks so much!!!

    Take care,
    Sean

Leave a Reply