title: Nesting content tags in rails
body: <p>Hey. I've got some code from Agile Web Development that wraps some HTML around a method call as so:</p>
  
  <pre><code>  # from tagged_builder.rb, included as a FormBuilder helper
   def self.create_tagged_field(method_name)
      define_method(method_name) do |label, *args|
        @template.content_tag("p",
          @template.content_tag("label" , 
                                label.to_s.humanize.capitalize, 
                                :for =&gt; "#{@object_name}_#{label}") 
                                 +
          super)
      end
    end
  </code></pre>
  
  <p>I would like to nest a span tag within the label content_tag, so that the final output would be along the lines of:</p>
  
  <pre><code>&lt;p&gt;&lt;label&gt;Name
          &lt;span class="small"&gt;Add your name&lt;/span&gt;
      &lt;/label&gt;
      &lt;input type="text" name="textfield" id="textfield" /&gt;
  </code></pre>
  
  <p></p></p>
  
  <p>I am wondering how I go about including the span's content (say a variable such as 'warning')</p>
  
  <p>I have tried all sorts, to no avail. The methods call ok (such as f.text_field :name will produce </p>
  
  <pre><code>&lt;p&gt;&lt;label for="object_name"&gt;Name&lt;/label&gt;&lt;/p&gt;
  </code></pre>
  
  <p>Have tried this:</p>
  
  <pre><code>  def self.create_tagged_field(method_name)
      define_method(method_name) do |label, warning, *args|
        @template.content_tag("p",
          @template.content_tag("label" , 
                                label.to_s.humanize.capitalize+
                                content_tag("span", warning), 
                                :for =&gt; "#{@object_name}_#{label}") 
                                 +
          super)
      end
    end
  </code></pre>
  
  <p>But no luck. Can anyone steer me in the right direction? Thanks, A</p>