Use nokogiri and the method text
which will strip the HTML tags from your content.
@doc.title().text
Question
I'm using Feedjira (Feedzirra) https://github.com/feedjira/feedjira to parse rss feeds in rails.
I need a way to remove html tags from the title of the rss feed items before I save to database.
in my create method which saves the feed item to the database
:title => feed_items_url.title
I tried to add simple_format to this but it didn't work
:name => simple_format(feed_items_url.title)
Solution
Use nokogiri and the method text
which will strip the HTML tags from your content.
@doc.title().text
OTHER TIPS
Rails has a built-in helper for strip HTML tags: strip_tags.
strip_tags(feed_items_url.title)