title: chef fill in xml values in template with hash in attribute
body: <p>I have an array of hashes with values in my attributes/default.rb file in chef like what I have below:</p>
  
  <pre><code>default['server']['database'] = [
      {
          'name' =&gt; 'srv1'
          'user' =&gt; 'usr1'
          'pass' =&gt; 'pwd1'
      },
      {
          'name' =&gt; 'srv2'
          'user' =&gt; 'user2'
          'pass' =&gt; 'pwd3'
      }
  ]
  </code></pre>
  
  <p>Then, I've got a templates/default/server.xml.erb file with the following nested loop:</p>
  
  <pre><code>&lt;% node['server']['database'].each do |hash| %&gt;
      &lt;% hash.each do |key, value| %&gt;
          &lt;%if key == "name" %&gt;
              &lt;Resource name="#{value}"
                  &lt;% else %&gt;
                      #{key}="#{value}"
                  &lt;% end %&gt;
              &lt;% end %&gt;
              /&gt;
          &lt;% end %&gt;
  </code></pre>
  
  <p>The expected result is:</p>
  
  <pre><code>&lt;Resource name="srv1"
      user="usr1"
      pass="pwd1"
  /&gt;
  &lt;Resource name="srv2"
      user="usr2"
      pass="pwd2"
  /&gt;
  </code></pre>
  
  <p>What I end up getting with this is:</p>
  
  <pre><code>&lt;Resource name="#{value}"
      #{key}="#{value}"
      #{key}="#{value}"
  /&gt;
  &lt;Resource name="#{value}"
      #{key}="#{value}"
      #{key}="#{value}"
  /&gt;
  </code></pre>
  
  <p>I've tried this in plain ruby and got it to print expected results.  Not sure what I'm doing wrong here, but please, if you could shed some light I would appreciate it.</p>