title: Sum returns value when should return 0
body: <p>I'm having a really confusing problem. Here it is:</p>
  
  <pre><code>[12] pry(EstimatedTime)&gt; EstimatedTime.where(user_id: User.current.id, plan_on: date).pluck(:hours) =&gt; [] 
  [13] pry(EstimatedTime)&gt; EstimatedTime.where(user_id: User.current.id, plan_on: date).sum(:hours) =&gt; 3.0
  </code></pre>
  
  <p>What kind of magic is this? </p>
  
  <p>This statement resides in model method, that is being called from view. Before that, in controller action, i'm calling another method of the same model, that is performing bulk create of records within transaction.</p>
  
  <pre><code>def self.save_all(records)
    transaction do
      records.each do |record|
        record.save!
      end
    end
    rescue ActiveRecord::RecordInvalid
      return false 
  end
  </code></pre>
  
  <p>The exception is being thrown, method returns false, view is rendered and this happens.</p>
  
  <p><strong>UPD</strong>
  I found a workaround, replacing <code>.sum</code> with <code>.pluck(:hours).sum</code>, but I still have no idea why my first way of doing this fails.</p>