This function...
class Invoice < ActiveRecord::Base
  def self.open_subtotal
    sum{ |i| i.open_amount / (1.00 + i.tax_rate / 100.00) }
  end
end
...gives me an error in Rails 4.0.2:
DEPRECATION WARNING: Calling #sum with a block is deprecated and will be removed in Rails 4.1. If you want to perform sum calculation over the array of elements, use
to_a.sum(&block).
When I add to_a before sum I get an undefined local variable or method to_a error.
What is the correct way to write this?
 
     
    