I need to get a ruby array in to a javascript array and I\'m getting a parse error.
var characters = <%= @poop.to_json %>;
That is how
You're treating a .js file like an .erb file - it's not. JavaScript files aren't parsed by Ruby - anything in public
is sent as-is.
One way to get @poop
into your JavaScript is to have a Rails action that renders json, then load that with XHR.
Alternatively, you could output @poop
in the HTML template in a tag, then load the contents of that script tag from your JavaScript.