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

Fix arguments of `AR::Calculations#sum` #21725

Merged
merged 1 commit into from Sep 23, 2015

Conversation

Projects
None yet
4 participants
@yui-knk
Contributor

yui-knk commented Sep 23, 2015

Arguments of #sum does not match with other shortcuts methods
(count, average, minimum, and maximum).
This commit fix these two points:

  • call super with only block arguments
    First argument of super method, Enumerable#sum, is identity
    and first argument of AR::Calculations#sum is column_name.
    Enumerable#sum does not expect column_name to be passed.
  • Change first argument of sum from array arguemnt to single
    argument to match other shortcuts methods. When sum accept
    array arguemnt, user can pass multi arguments and an exception is
    raised from calculate.
Fix arguments of `AR::Calculations#sum`
Arguments of `#sum` does not match with other shortcuts methods
(count, average, minimum, and maximum).
This commit fix these two points:

* call `super` with only block arguments
  First argument of `super` method, `Enumerable#sum`, is `identity`
  and first argument of `AR::Calculations#sum` is `column_name`.
  `Enumerable#sum` does not expect `column_name` to be passed.
* Change first argument of `sum` from array arguemnt to single
  argument to match other shortcuts methods. When `sum` accept
  array arguemnt, user can pass multi arguments and an exception is
  raised from `calculate`.
@rails-bot

This comment has been minimized.

Show comment
Hide comment
@rails-bot

rails-bot Sep 23, 2015

r? @kaspth

(@rails-bot has picked a reviewer for you, use r? to override)

rails-bot commented Sep 23, 2015

r? @kaspth

(@rails-bot has picked a reviewer for you, use r? to override)

rafaelfranca added a commit that referenced this pull request Sep 23, 2015

Merge pull request #21725 from yui-knk/fix/ar_sum
Fix arguments of `AR::Calculations#sum`

@rafaelfranca rafaelfranca merged commit 7c08e1a into rails:master Sep 23, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment