新手问题 rails api strip_tags and strip_links method 怎么不可以用求解释!!!

zhq_zhq · March 10, 2014 · Last by zhq_zhq replied at March 13, 2014 · 1982 hits

strip_tags("Strip these tags!")
出现如下错误

strip_links 已经去除了,可以使用 gem,strip_tags 是 ActionView 内的方法,只有在 html 模版文件中才能使用,当然在其它地方使用的话 include 下 ActionView

helper.strip_tags("Strip <i>these</i> tags!")

在 controller 中使用 view_content.strip_tags
console 中需要 include ActionView::Helpers::SanitizeHelper strip_tags("Strip these tags!")

或者:3 楼说的: helper.strip_tags("Strip <i>these</i> tags!")

@kingwkb ;@leomayleomay;@huhongda谢谢!用 sanitize(HTML,tags=[])

You need to Sign in before reply, if you don't have an account, please Sign up first.