验证前删除所有html标记

时间:2021-12-23 00:15:31

is there a clean way to remove all html tag of all attributes before validation I found acts_as_sanitized that seemed to be perfect, but for rails 2 :-s

有没有一种干净的方法来删除所有属性的所有html标签验证之前我发现acts_as_sanitized似乎是完美的,但对于rails 2:-s

thanks

谢谢

1 个解决方案

#1


0  

The sanitize gem:

消毒宝石:

https://github.com/rgrove/sanitize

https://github.com/rgrove/sanitize

Does what you need.

你需要什么

Call Sanitize.clean(htmlstring). You can whitelist allowed tags as well.

调用Sanitize.clean(htmlstring)。您也可以将允许的标签列入白名单。

#1


0  

The sanitize gem:

消毒宝石:

https://github.com/rgrove/sanitize

https://github.com/rgrove/sanitize

Does what you need.

你需要什么

Call Sanitize.clean(htmlstring). You can whitelist allowed tags as well.

调用Sanitize.clean(htmlstring)。您也可以将允许的标签列入白名单。