Sorry for leaving issues like these unattended for so long.
The issue you're having there is that update.js.haml
is instructing Haml to render it as plain text and not inside a script tag. That's why the browser would never run it; you should be using :javascript
instead, as follows:
#update.js.haml
:javascript
alert("ok");
In any way, most times you will want to reference external assets, i.e., real JS files. If you need to bootstrap those with some data at load time you can look at alternatives such as injecting a script tag containing a variable that will set the initial data and consume it in your application (there are different ways of doing this). Alternatively, you can load that data through AJAX or WS, bear in mind that this creates more connections to the server and may have the user waiting, so it's not a good approach if the data needs to be ready at load if, say, you're building an SPA.