title: Best practice method of displaying flash messages
body: <p>I'm wondering what's the best practice for displaying flash messages.  The two main ways I've seen are using something like this scaffold generated code</p>
  
  <pre><code>&lt;p id="notice"&gt;&lt;%= notice %&gt;&lt;/p&gt;
  </code></pre>
  
  <p>or placing code like this in your application header.</p>
  
  <pre><code>&lt;% if !flash.empty? %&gt;
      &lt;div id="flash"&gt; 
          &lt;% flash.keys.each do |k| %&gt; 
              &lt;div class="&lt;%= k %&gt;"&gt;
                  &lt;%= flash[k] %&gt;
              &lt;/div&gt;  
          &lt;% end %&gt;   
      &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>It appears to me that the first method adds more flexibility while the latter improves code readability and eliminates redundancy.  Is there a method most rails developers prefer?  As a side question how does scaffolding implement notice?  Is it just a helper that accesses the flash hash?  Why go through the trouble of using the helper when you can directly use the flash hash?  Thanks</p>