title: How does a helper method yield to a block in rails 3?
body: <p>I have used this pattern for a number of helpers in rails 2, but it isn't working the same in rails 3. My goal is to have a helper method generate some html tags with content nested inside. Here is a basic example of what I'm trying to get:</p>
  
  <pre><code>&lt;div class="box"&gt;
    my content
  &lt;/div&gt;
  </code></pre>
  
  <p>In rails 2 I do it like this:</p>
  
  <p>inside my layout file I call the helper method:</p>
  
  <pre><code>  &lt;% box_wrapper do %&gt;
      &lt;%= yield -%&gt;
    &lt;% end %&gt;
  </code></pre>
  
  <p>The helper method is defined like this:</p>
  
  <pre><code>def box_wrapper
    concat &lt;&lt;-EOF.html_safe
      &lt;div class="box"&gt;
    EOF
  
    yield  if block_given?
    concat &lt;&lt;-EOF.html_safe
      &lt;/div&gt;
    EOF
  end
  </code></pre>
  
  <p>But in rails 3 when the view gets rendered it outputs my entire page and then inside the <code>box_wrapper</code> it renders all of the page content a 2nd time.</p>
  
  <p>I think I'm missing something obvious with how to use helpers and yields. Any ideas?</p>