<%= escape_javascript(render(@comment)) %>这块就是 ERB 处理的内容,查 Rails API 这个方法用法就好了...
# File actionview/lib/action_view/helpers/javascript_helper.rb, line 25
def escape_javascript(javascript)
if javascript
result = javascript.gsub(/(\|<\/|\r\n|\342\200\250|\342\200\251|[\n\r"'])/u) {|match| JS_ESCAPE_MAP[match] }
javascript.html_safe? ? result.html_safe : result
else
''
end
end