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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With