Today I Learned

hashrocket A Hashrocket project

Strip HTML tags in Rails Views

Rails ActionView::Helpers::SanitizeHelper includes a super handy method strip_tags that removes html tags from a string.

strip_tags("<p>Hello World Paragraph</p>")
#=> Hello World Paragraph

strip_tags("<a href=https://google.com>Cool Link!</a>")
#=> Cool Link!

Read more about it here

See More #rails TILs
Looking for help? Hashrocket has been an industry leader in Ruby on Rails since 2008. Rails is a core skill for each developer at Hashrocket, and we'd love to take a look at your project. Contact us and find out how we can help you.