提交 140b269f 编写于 作者: J Jon Leighton

Call sum on the scope directly, rather than relying on method_missing and calculate

上级 ca778584
......@@ -125,9 +125,9 @@ def destroy_all
# Calculate sum using SQL, not Enumerable
def sum(*args)
if block_given?
calculate(:sum, *args) { |*block_args| yield(*block_args) }
scoped.sum(*args) { |*block_args| yield(*block_args) }
else
calculate(:sum, *args)
scoped.sum(*args)
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册