From cd9d5c115012e3e8644b359594fdd75459f43dfa Mon Sep 17 00:00:00 2001 From: yui-knk Date: Mon, 25 Apr 2016 10:11:41 +0900 Subject: [PATCH] Remove `Array#sum` method before override it To suppress warning ('warning: method redefined; discarding old sum') remove the method before override it. Signed-off-by: Jeremy Daer --- activesupport/lib/active_support/core_ext/enumerable.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/activesupport/lib/active_support/core_ext/enumerable.rb b/activesupport/lib/active_support/core_ext/enumerable.rb index 0e03f7d7be..941f20c19d 100644 --- a/activesupport/lib/active_support/core_ext/enumerable.rb +++ b/activesupport/lib/active_support/core_ext/enumerable.rb @@ -112,6 +112,8 @@ end # just calling the compat method in the first place. if Array.instance_methods(false).include?(:sum) && !(%w[a].sum rescue false) class Array + remove_method :sum + def sum(*args) #:nodoc: # Use Enumerable#sum instead. super