title: Rails cookies value different from controler with helper scope?
body: <p>ENV:</p>
  
  <p>Rails 3.2.15<br>
  ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.0]</p>
  
  <p>I set cookies in controller and read it from helper method, and two result is not same. Why?</p>
  
  <pre><code># in controller
  cookies[:"position"] = { :value =&gt; [ 100,200 ], :expires =&gt; 1.years.from_now }
  # read it same time, it display value is an array [100, 200]
  # But I read this cookies in another request, it display "100&amp;200"
  
  
  # in helper
  module WelcomeHelper
    def get_position
      cookies[:"position"]
    end
  
  end
  </code></pre>
  
  <p>```</p>
  
  <p><code>get_position</code> method return <code>100&amp;200</code></p>
  
  <p>Where can I find some documation? I found in code, it discribled array can be stored in cookies directly and read it directly: <a href="https://github.com/rails/rails/blob/v3.2.15/actionpack/lib/action_dispatch/middleware/cookies.rb#L45" rel="nofollow">https://github.com/rails/rails/blob/v3.2.15/actionpack/lib/action_dispatch/middleware/cookies.rb#L45</a> , but why I stored an arry in cookies and result from read is a string?</p>