I'm using rails 3. In my index.html.erb and in my index.js.erb, if I have:
<%= "string with unsafe characters' like <" %>
It will automatically be encoded to:
string with unsafe characters" like &
just the same as if I had used:
<%=h "string with unsafe characters' like <" %>
How do I get it to stop? I have stored some short bits of JavaScript that I need to insert into the template without it automatically encoding the string?
Just use the raw
method like this:
<%=raw "string with unsafe characters' like <" %>
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