title: Treating nil as zero in sum function
body: <p>I have a Seller model that has_many Items.</p>
  
  <p>I want to get the total sale price of all of a Seller's items.</p>
  
  <p>In seller.rb I have</p>
  
  <pre><code>def total_item_cost 
    items.to_a.sum(&amp;:sale_price)
  end
  </code></pre>
  
  <p>This works fine if all the items <em>have</em> a sale price.<br>
  However, if they haven't been sold yet, <code>sale_price</code> is nil and the <code>total_item_cost</code> breaks.</p>
  
  <p>In my app, <code>sale_price</code> can be either a nil or a zero.</p>
  
  <p>In my <code>total_item_cost</code> method, how can I treat <code>nil</code> values as zeros?</p>