{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/25802","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/25802/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/25802/comments","events_url":"https://api.github.com/repos/rails/rails/issues/25802/events","html_url":"https://github.com/rails/rails/issues/25802","id":165170076,"number":25802,"title":"Can't assign a hash to a cookie","user":{"login":"rosenfeld","id":32246,"avatar_url":"https://avatars.githubusercontent.com/u/32246?v=3","gravatar_id":"","url":"https://api.github.com/users/rosenfeld","html_url":"https://github.com/rosenfeld","followers_url":"https://api.github.com/users/rosenfeld/followers","following_url":"https://api.github.com/users/rosenfeld/following{/other_user}","gists_url":"https://api.github.com/users/rosenfeld/gists{/gist_id}","starred_url":"https://api.github.com/users/rosenfeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosenfeld/subscriptions","organizations_url":"https://api.github.com/users/rosenfeld/orgs","repos_url":"https://api.github.com/users/rosenfeld/repos","events_url":"https://api.github.com/users/rosenfeld/events{/privacy}","received_events_url":"https://api.github.com/users/rosenfeld/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/actionpack","name":"actionpack","color":"FFF700"},{"url":"https://api.github.com/repos/rails/rails/labels/needs%20work","name":"needs work","color":"000000"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-07-12T20:15:58Z","updated_at":"2016-07-13T10:41:41Z","closed_at":null,"body":"I don't actually use a hash as a cookie value, but while investigating how cookies work I faced something which I think is either a bug in the documentation or in the code, so I'm describing it here since I don't know which one is the case.\r\n\r\nAssigning a hash to some cookie (cookies['name'], cookies.signed['name'], cookies.encrypted['name], doesn't matter) is silently ignored. `cookies['hash'] = {'a' => 1}` will generate an invalid encoded cookie (or maybe the equivalent of nil encoded).\r\n\r\nThis happens with either JSON or Marshal used as the serializer.\r\n\r\nThe API doesn't specify that a hash is not a supported value:\r\n\r\nhttp://api.rubyonrails.org/classes/ActionDispatch/Cookies.html\r\n\r\nIs the current behavior expected? If so, I can send a patch to fix the documentation."},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/232320209","html_url":"https://github.com/rails/rails/issues/25802#issuecomment-232320209","issue_url":"https://api.github.com/repos/rails/rails/issues/25802","id":232320209,"user":{"login":"rosenfeld","id":32246,"avatar_url":"https://avatars.githubusercontent.com/u/32246?v=3","gravatar_id":"","url":"https://api.github.com/users/rosenfeld","html_url":"https://github.com/rosenfeld","followers_url":"https://api.github.com/users/rosenfeld/followers","following_url":"https://api.github.com/users/rosenfeld/following{/other_user}","gists_url":"https://api.github.com/users/rosenfeld/gists{/gist_id}","starred_url":"https://api.github.com/users/rosenfeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosenfeld/subscriptions","organizations_url":"https://api.github.com/users/rosenfeld/orgs","repos_url":"https://api.github.com/users/rosenfeld/repos","events_url":"https://api.github.com/users/rosenfeld/events{/privacy}","received_events_url":"https://api.github.com/users/rosenfeld/received_events","type":"User","site_admin":false},"created_at":"2016-07-13T10:41:41Z","updated_at":"2016-07-13T10:41:41Z","body":"While creating the test case I noticed that not only the bug is also present on Rails 4 but it doesn't affect only hashes. If you set it to a number it will be converted to a string the next time you try to read that value from the cookie:\r\n\r\nhttps://gist.github.com/rosenfeld/7a7b05a23ad2cce2f3fd17296abbea64\r\n\r\nSeems like an old bug though since the output is the same on Rails 4.\r\n\r\nI hope that helps."}}
{"actor":{"display_login":"rosenfeld"}}