title: Write XML data into XML file
body: <p>I want ot implement very simple example of XML file. I tested this example:</p>
  
  <pre><code>builder = Nokogiri::XML::Builder.new(:encoding =&gt; 'UTF-8') do |xml|
      xml.root {
       xml.products {
        xml.widget {
         xml.id_ "10"
         xml.name "Awesome widget"
        }
       }
      }
     end
     puts builder.to_xml
     file = File.new("builder.xml", "w")
  </code></pre>
  
  <p>But when I open the XML file it's empty. How I can write the XML content?</p>