title: Pass instance variable to js Rails
body: <p>In my search controller I have an instance variable, <code>@results</code>. I set it to return a dummy result, <code>'foo'</code>.</p>
  
  <p>In my search.html.erb view... I set window.results = <code>&lt;%= raw @results.to_json %&gt;</code>.</p>
  
  <p>At the top of my search.js asset file, I <code>console.log(results)</code> and get <code>undefined</code>, but when I get into the devtools after the page load, results is populated with <code>'foo'</code>. The console.log statement is also wrapped in a jquery ready function.</p>
  
  <p>What gives?</p>