public Method

SanitizeHelper.strip_links(html)

Strips all link tags from text leaving just the link text.

Examples

strip_links('<a href="http://www.rubyonrails.org">Ruby on Rails</a>')
# => Ruby on Rails

strip_links('Please e-mail me at <a href="mailto:me@email.com">me@email.com</a>.')
# => Please e-mail me at me@email.com.

strip_links('Blog: <a href="http://www.myblog.com/" target="\"_blank\">Visit</a>.')
# => Blog: Visit

Source Code

# File action_view/helpers/sanitize_helper.rb, line 89
def strip_links(html)
  self.class.link_sanitizer.sanitize(html)
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.