title: Rails 3.1: Ruby idiom to prevent .each from throwing exception if nil?
body: <p>Is there a way to use <code>.each</code> so it does not throw an error if the object is nil or empty (without adding an additional nil/blank test?</p>
  
  <p>It seems that if I say <code>phonelist.each do |phone|</code> that if phonelist is empty, then the block should not be executed.</p>
  
  <p>But in my view (haml) I have <code>- @myvar.phonelist.each do |phone|</code> and if phonelist is empty, it throws a NoMethodError.</p>
  
  <p>I run into this a lot, and always workaround by adding an explicit check/branch for .blank? but it seems there should be an easier way to tell .each that empty means do nothing.</p>