I have in my stock rails 3.1 app's projects#index.html.erb a javascript section to reads like this:
<script type="text/javascript" charset="utf-8">
var projects = <%= @projects.to_json.html_safe -%>
$(function () {
// some other code...
});
</script>
However, Chrome's console complains that "Uncaught SyntaxError: Unexpected identifier"
now, if I remove anything that follows the "var projects" line like this
<script type="text/javascript" charset="utf-8">
var projects = <%= @projects.to_json.html_safe -%>
</script>
everything is fine and when one typed "projects" in the Chrome javascript console, I do get the list of objects [ object, object, object, ..., object ]
I cannot work out what the issue is here, can you help?
Thanks!