title: Parsing an RSS Feed in Ruby
body: <p>So I'm new to Ruby on Rails, but I'm basically trying to parse through a feed using <code>SimpleRSS</code>, and then store various values and display it. I'm using MongoDB/the mongoid gem as the database.</p>
  
  <p>I can parse through the feed, but then none of the values get correctly stored.</p>
  
  <pre><code>class FeedEntry
  
    include Mongoid::Document
    require 'rubygems'
    require 'simple-rss'
    require 'open-uri'
  
    field :name, type: String
    field :summary, type: String
    field :url, type: String
    field :published_at, type: DateTime
    field :guid, type: Integer
  
    def self.rssFeeder(feed_url)
      feed = SimpleRSS.parse open(feed_url)
      feed.items.each do |entry|
        unless FeedEntry.where(guid: entry.id).exists?
          FeedEntry.create!(
            name: entry.title,
            summary: entry.summary,
            url: entry.link,
            published_at: entry.pubDate,
            guid: entry.id
          ) 
        end
      end
    end
  
  end
  </code></pre>
  
  <p>I can get that <code>FeedEntry.count</code> is 76, but all of the values stored are <code>nil</code>.</p>
  
  <p>Does anyone see a clear error?</p>