Method: ActionView::Helpers::SanitizeHelper#strip_tags

Defined in:
actionview/lib/action_view/helpers/sanitize_helper.rb

#strip_tags(html) ⇒ Object

Strips all HTML tags from html, including comments and special characters.

strip_tags("Strip <i>these</i> tags!")
# => Strip these tags!

strip_tags("<b>Bold</b> no more!  <a href='more.html'>See more here</a>...")
# => Bold no more!  See more here...

strip_tags("<div id='top-bar'>Welcome to my website!</div>")
# => Welcome to my website!

strip_tags("> A quote from Smith & Wesson")
# => &gt; A quote from Smith &amp; Wesson


104
105
106
# File 'actionview/lib/action_view/helpers/sanitize_helper.rb', line 104

def strip_tags(html)
  self.class.full_sanitizer.sanitize(html)&.html_safe
end