title: In Rails 5, how access cookies method in a model or helper?
body: <p>How does one access cookies inside a Rails model or helper?</p>
  
  <p>Trying to dry up some controller methods, I am trying to move multiple controller calls to cookies() into application_helper.rb and/or a model.</p>
  
  <p>What <strong>doesn't</strong> work in application_helper.rb:</p>
  
  <pre><code>cookies[:foo]
  ActionDispatch::Cookies.cookies[:foo]
  ActionController.cookies[:foo]
  ActionDispatch::Cookies::ChainedCookieJars.cookie[:foo]
  </code></pre>
  
  <p>All of which result in undefined method 'cookies'</p>
  
  <p>Note: Well-meaning answers that simply regurgitate MVC dogma are mis-placed here... I've architected long enough (decades) to know when coloring outside the MVC lines (if possible) is the better route. But the precise syntax eludes me even after digging through Rails source. This question is prompted by a somewhat complex situation related to, among other things, inconsistent browser handling of cookies in cross-domain, ajax environment that sometimes includes local files (for which Chrome declines to manage cookies). </p>