1

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)
user3213561
  • 359
  • 1
  • 4
  • 15

2 Answers2

1

Use nokogiri and the method text which will strip the HTML tags from your content.

@doc.title().text
Raj
  • 22,346
  • 14
  • 99
  • 142
0

Rails has a built-in helper for strip HTML tags: strip_tags.

strip_tags(feed_items_url.title)
Florent Ferry
  • 1,397
  • 1
  • 10
  • 21