Skip to content

Commit

Permalink
Merge pull request #21725 from yui-knk/fix/ar_sum
Browse files Browse the repository at this point in the history
Fix arguments of `AR::Calculations#sum`
  • Loading branch information
rafaelfranca committed Sep 23, 2015
2 parents 624253f + 0f6d47d commit 7c08e1a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions activerecord/lib/active_record/relation/calculations.rb
Expand Up @@ -70,9 +70,9 @@ def maximum(column_name)
# +calculate+ for examples with options.
#
# Person.sum(:age) # => 4562
def sum(*args)
return super if block_given?
calculate(:sum, *args)
def sum(column_name = nil, &block)
return super &block if block_given?
calculate(:sum, column_name)
end

# This calculates aggregate values in the given column. Methods for count, sum, average,
Expand Down

0 comments on commit 7c08e1a

Please sign in to comment.