infinitered / cdq

Core Data Query for RubyMotion
MIT License
172 stars 35 forks source link

odd behavior with .sum( ) #127

Open dam13n opened 8 years ago

dam13n commented 8 years ago

In my app I'm assigning transactions to a job. Then I try these methods (in app and in REPL have the same result):

Transaction.year_2016.where(:job).eq(job).sum(:amount)
=> 0.0

Transaction.year_2016.where(:job).eq(job).inject(0.0) { |sum, t| sum = sum + t.amount }
=> -104.75

If I relaunch the app, the .sum() works as expected.