Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

odd behavior with .sum( ) #127

Open
dam13n opened this issue Feb 24, 2016 · 0 comments
Open

odd behavior with .sum( ) #127

dam13n opened this issue Feb 24, 2016 · 0 comments

Comments

@dam13n
Copy link

dam13n commented Feb 24, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant