问题
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
thanks
回答1:
The sanitize gem:
https://github.com/rgrove/sanitize
Does what you need.
Call Sanitize.clean(htmlstring). You can whitelist allowed tags as well.
来源:https://stackoverflow.com/questions/15650609/remove-all-html-tag-before-validation