Doing this within an action won't return the expected result:
cookies[:abc] = "123"
render :text => cookies[:abc]
The reason has nothing to do with strings/symbols as cookie keys but
is due to the fact that ActionController's cookies method gets a fresh
CookieJar every time it's called.
The fix (monkeypatched here in an initializer) is simply:
I even note that the = method seems to call super as if this
functionality is expected to work.
I know everyone's probably focussed on 3.0, but this is a real doozy
of an issue if you hit it (for example, see the blog post at -
- not mine!).