1

A basic task: evaluate field's value and show warning if results are not satisfying. The actual code doesn't matter, since it works perfectly until I actually change sample warning's test to the one, which should actually be there, which throws this accursed error at me:

Error: Encoding::UndefinedConversionError: U+0417 from UTF-8 to ISO-8859-1

In any other case I would've used i18n or magic comment, but neither seem to work here, since apparently you can't mix ruby into .coffee file. Is there any way to avoid this without resorting to putting unnecessary javascript into views?

4

1 回答 1

3

可以在咖啡脚本资产中使用 ruby​​。只需将文件重命名为.js.erb.coffee并使用 good old <%= ruby_code %>

于 2012-04-08T16:43:07.467 回答