Reputation: 2250
My .js.erb file looks like this:
console.log("<%= escape_javascript render("users/list") %>");
The problem here is that the whole embedded Ruby part is interpreted as a JavaScript String (no Syntax Highlighting inside) which I want to avoid. I have not found any solution to this. I have tried looking into the .tmLanguage
file but all in vain.
Any way to accomplish this?
Upvotes: 0
Views: 339
Reputation: 8003
Try this, idea to get the Ruby part out of the quotes.
console.log(<%='"'.html_safe + escape_javascript( render("users/list") ) + '"'.html_safe %>);
Upvotes: 1