`
kukuqiu001
  • 浏览: 209049 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

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
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics