Inline ruby in :javascript haml tag? [duplicate]
Hey is there a way I can do this in haml?
:javascript
var Tab = <%= @tab %>
I could just add a helper I guess like:
<script>
var Tab = '<%= @tab %>'
</script>
But it'd be nice to use HAML!
You can use the string interpolation syntax (#{...}
) :
:javascript
var tab = #{@tab}
Take care of correctly escaping, however.