I'd like to use chartjs with rails in a view, it works great, but when using an option like this one :
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
rails will interpret <% and run name.toLowerCase() as a ruby code, which is actually javascript, how can I escape '<%' in rails?
add an extra percent sign:
or
BTW in case you want to start googling for stuff instead of using SO, i googled "escape erb tags" to get this, i'd not done it before.