title: Nokogiri XML Parsing with Rails
body: <p>I looked at a lot of tuts but <a href="https://stackoverflow.com/questions/3938810/parsing-simple-xml-with-nokogiri">this</a> one seems to have got me where I am</p>
  
  <p>controller</p>
  
  <pre><code>  def index
        require 'nokogiri'
        doc = Nokogiri::XML(open("http://sports.yahoo.com/top/rss.xml"))
  
        @links = doc.xpath('//item').map do |i|
        {'title' =&gt; i.xpath('title'), 'link' =&gt; i.xpath('link'), 'description' =&gt; i.xpath('description')}
        end
    end
  </code></pre>
  
  <p>view</p>
  
  <pre><code>&lt;ul&gt;
    &lt;%= debug @links.each.first %&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>debug out put</p>
  
  <p><code>{"title"=&gt;[#&lt;Nokogiri::XML::Element:0x8199ce34 name="title" children=[#&lt;Nokogiri::XML::Text:0x8199c6f0 "Kolb to get start for Eagles vs. Falcons (AP)"&gt;]&gt;], "description"=&gt;[#&lt;Nokogiri::XML::Element:0x8199b660 name="description" children=[#&lt;Nokogiri::XML::Text:0x8199a594 "Kevin Kolb will make his second straight start in place of the injured Michael Vick when the Philadelphia Eagles host Atlanta on Sunday. Eagles coach Andy Reid says Vick practiced Friday for the first time since sustaining a rib cartilage injury on Oct. 3. There's a chance Vick will be the backup quarterback against his former team."&gt;]&gt;], "link"=&gt;[#&lt;Nokogiri::XML::Element:0x81999f40 name="link" children=[#&lt;Nokogiri::XML::Text:0x81999b58 "http://us.rd.yahoo.com/sports/rss/top/SIG=11npql9k5/*http%3A//sports.yahoo.com/nfl/news?slug=ap-eagles-qbs"&gt;]&gt;]}</code></p>
  
  <p>What I need is to loop over the links array and access the hash with the title and link, but I don't know how to do that.</p>