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