I have source code for an app that uses Ember,CoffeeScript, Haml with Rails. In the layout file, it initiates the app with this code, which has a current_user_json helper method written in Ruby
:javascript
App.ready = function() {
App.initApp(jQuery.parseJSON('#{current_user_json}'))
}
Trying to recreate the app with erb and JavaScript, I get an unexpected token error
Uncaught SyntaxError: Unexpected token #
If I do the following
<script type="text/javascript">
App.ready = function() {
App.initApp(jQuery.parseJSON('#{ current_user_json}'));
}
</script>
Why is that token unexpected and how can I avoid that error?
#{ variable }interpolation is only for HAML.