Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Im calling my feed with <%= blog_feed %> inside the view and have a little snippet in my helper.

require 'rss/1.0'
require 'rss/2.0'
require 'open-uri'

def blog_feed
    source = "http://www.domain.com/.rss" # url or local file
    content = "" # raw content of rss feed will be loaded here
    open(source) do |s| content = s.read end
    rss = RSS::Parser.parse(content, false)

    html = "<ul>"
    rss.items.first(3).each do |i|
    html << "<li><a href='#{i.link}'>#{i.title}</a></li>"
    end
    html << "</ul>"
    html


  end

It runs mostly the way i want. But the html is inline html. So i see li,ul and a hrefs on the website.

Any idea or suggestion?

best regards denym

share

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.