title: Can't remove node in Nokogiri
body: <p>I'm having a bit of a strange issue with Nokogiri in Rails.  I'm trying to remove a "p" tag with a class of "why".  I have the following code, which doesn't work:</p>
  
  <pre><code>def test_grab
    f = File.open("public/test.html")
    @doc = Nokogiri::HTML.parse(f)
    f.close
    @doc = @doc.css("p")
    @doc.each do |p|
      if p["class"] == "why"
        logger.info p.values
        p.remove
      end
    end
  end
  </code></pre>
  
  <p>test.html:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Test&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;p&gt;Test data&lt;/p&gt;
      &lt;p&gt;More &lt;a href="http://stackoverflow.com"&gt;Test Data&lt;/a&gt;&lt;/p&gt;
      &lt;p class="why"&gt;Why is this still here?&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Output html source:</p>
  
  <pre><code>&lt;p&gt;Test data&lt;/p&gt;
  &lt;p&gt;More &lt;a href="http://stackoverflow.com"&gt;Test Data&lt;/a&gt;&lt;/p&gt;
  &lt;p class="why"&gt;Why is this still here?&lt;/p&gt;
  </code></pre>
  
  <p>I know the rails code is going into the if loop because the logger.info shows up on the server terminal.</p>
  
  <p>Any ideas?</p>