rails3 的json_escape、 java_escape、html_escape

json_escape、 javascript_escape
json 和javascript 在 rails的html.erb 文件中需要转义
在html.erb文件中可以简写为 <%=j  %>

html_escape 是对html进行转义,在rails3以上已经全部在<%= %> 中默认加载了


rails的文档: http://api.rubyonrails.org/classes/ERB/Util.html
详细解释为什么要javascript转义: http://stackoverflow.com/questions/1620113/why-escape-javascript-before-rendering-a-partial

你可能感兴趣的:(escape)