Reputation: 1139
What's a good solution to parse an RSS/ATOM feed and present the content in a Rails view?
Upvotes: 2
Views: 972
Reputation: 15097
id recommend acts_as_feed, which takes care of parsing automatically acts as feed rails plugin and can be added to models. Another solution would be to use google feed api as long as you only need to display the feed.
#HAML view example
- if feed.filled?
%h2="Blog: #{feed.title}"
- for item in feed.entries[0...5]
-date = item.published_at.to_date.to_s(:long)
%h2=link_to(h(item.title),h(item.url))
Upvotes: 0
Reputation: 881635
I've seen good notes on the parsing part at http://www.robbyonrails.com/articles/2005/05/11/parsing-a-rss-feed (and links therefrom). How to best present things once you have parsed them is maybe a bit of a subjective issue...
Upvotes: 4