Unable to set expiry date on cookies

cookies[:user_info] = {:value => "whatever", :expires => 30.days.from_now }

When I check in the browser, the cookie will expire "at end of session" Oo What's happening? How to set the cookie's date then?

Thanks :slight_smile:

The code looks fine. Are you sure you haven’t set your browser to “Private Browsing”? Because that would result in all cookies expiring at the end of the session.

Best regards

Peter De Berdt

Hi Peter,

I just checked and my browser is not in private mode. In the response I can see that a header is set-cookie with a date forward in time, so something strange is happening here.

Ok my bad. I tested in Safari and it works perfectly, so there is something blocking in Firefox 3.6, but the expiry date setting works with other sites, so I don't understand what's happening.

Is there some edge case scenario I'm missing here? Should all options of the cookie be set?

"So stupid! I just noticed that in FF the option "Keep until: I close Firefox" was set, I must have done that inadvertently.

Sorry for my silly problem.