Danyel
Danyel

Reputation: 2250

Sublime Text Language (JavaScript (Rails)) Embedded Ruby in String

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

Answers (1)

tihom
tihom

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

Related Questions