Cannot write persistent cookies

I experimented with a persistent cookie shortcut with Rails 3.0 (and Ruby 1.9.2), but I can't write in this hash. <br> I am trying to use the following code:

cookies.permanent[:last_used_expiration_delay] = @snippet.expiration_delay 

But the hash remains empty (here is the YAML dump):

  --- !map:ActionDispatch::Cookies::PermanentCookieJar {} 

Basic cookies work well, so I can specify an expiration date manually with the old syntax, but I would like to use the new Rails 3 class.

Is there anything you need for persistent cookies to work properly?

+4
source share
1 answer

I found the answer: cookies.permanent used for writing purposes only. To read, just look at the key in the cookies hash.

+5
source

All Articles