title: Set a cookie from view, then read it from Controller in Rails
body: <p>I would like to set cookie value from within Rails view using Javascript, then use Controller to read this cookie. Is this possible with Rails, and how should I go about it?</p>
  
  <p>My situation: I have an input field (say, address) that user needs to fill out when s/he first comes to my site. The user then logs in using Omniauth. I would like to persist address until after he logs in.</p>
  
  <p>Update: 
  I was able to add to document.cookies on client. However, cookies["something"] returns nil from Rails end. Below is the cookie hash:</p>
  
  <p><code>#&lt;ActionDispatch::Cookies::CookieJar:0x007 @secret="f4d518c0b2", @set_cookies={}, @delete_cookies={}, @host="localhost", @secure=false, @closed=false, @cookies={"_myapp_session"=&gt;"BAh7Ck==--776b2fcfcd63d3c84d2b1de5327e277499add6d4", "fbsr_1505068851081"=&gt;"mqZeyvoRC"}, @signed=#&lt;ActionDispatch::Cookies::SignedCookieJar:0x007 @parent_jar=#&lt;ActionDispatch::Cookies::CookieJar:0x007fdf...&gt;, @verifier=#&lt;ActiveSupport::MessageVerifier:0x007fdfa34548d8 @secret="f4d518c0b2e9d8", @digest="SHA1", @serializer=Marshal&gt;&gt;&gt;</code></p>