title: Rails Nokogiri get xml from url
body: <p>I recently learned how to import XML feeds into rails using nokogiri with the following code.</p>
  
  <p>Instead of downloading my feed from an URL, I have the option to access it directly from an URL.</p>
  
  <p>let's say that URL is `www.feedurl.com'</p>
  
  <p>how would I update the below code to get it from that URL:</p>
  
  <pre><code>class Product &lt; ApplicationRecord 
      def self.xml_parser
          doc = Nokogiri::XML(open("#{Rails.root}/datafeed.xml"))
          frothieproducts = doc.xpath('//FeedItems/FeedItem')
          frothieproducts.map do |feeditem|
              product = Product.new
              product.product_name = feeditem.xpath('Name').text
              product.product_description = feeditem.xpath('Description').text
              product.product_link = feeditem.xpath('Url').text
              product.save!
          end
      end
  end
  </code></pre>