title: Add property or modify cookie in rails
body: <p>I have a cookie that is already set in the code already. I just want to add a flag <code>{httponly: true}</code> to it. I tried with <code>merge</code> method but I get error saying that merge can not be applied to string. Then I tried with this  <code>cookies[:riko_added_http_only] &lt;&lt; '; HttpOnly'</code>, but I see in the browser cookies that the cookie is not httponly.</p>
  <p>So the question is how to add/modify cookie property or flag(as <code>httponly</code> or <code>secure</code>) after some value is already assigned to it?</p>
  <p>Here is some exampe:</p>
  <pre><code>    cookies[:riko_added_http_only] = {
        value: 'rikob',
      }
      ........ Some code here ....................
      cookies[:riko_added_http_only] &lt;&lt; '; HttpOnly'
  </code></pre>
  <p><strong>EDIT</strong>:</p>
  <p>Let me add some more information and test examples:</p>
  <p>From this code:</p>
  <pre><code>    cookies[:secure_true_http_true] = {
        value: 'httpOnly, not Secure',
        httponly: true,
        secure: true
      }
      cookies[:secure_true_http_false] = {
        value: 'Secure NOT HttpOnly',
        httponly: false,
        secure: true
      }
      cookies[:secure_false_http_true] = {
        value: 'Secure and http only',
        httponly: true,
        secure: false
      }
  
      cookies[:riko_added_http_only] = {
        value: 'rikob',
      }
  
      cookies[:riko_added_http_only] = {
        value: &quot;#{cookies[:riko_added_http_only]}; HttpOnly&quot;
      }
  </code></pre>
  <p>I get this result:
  <a href="https://i.stack.imgur.com/3v7D3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3v7D3.png" alt="enter image description here" /></a></p>