From d29f7fbb10a9c8edeaf0d4f62b2195376eddd0b8 Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Tue, 13 Oct 2015 11:16:49 -0500 Subject: [PATCH] Only prepend a single module when defining deprecation wrappers. I could not find any reason why each method got its own prepended module here, and all tests appear to pass with my change. --- .../lib/active_support/deprecation/method_wrappers.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/activesupport/lib/active_support/deprecation/method_wrappers.rb b/activesupport/lib/active_support/deprecation/method_wrappers.rb index c74e9c40ac..91050d18f0 100644 --- a/activesupport/lib/active_support/deprecation/method_wrappers.rb +++ b/activesupport/lib/active_support/deprecation/method_wrappers.rb @@ -30,16 +30,16 @@ module ActiveSupport deprecator = options.delete(:deprecator) || ActiveSupport::Deprecation.instance method_names += options.keys - method_names.each do |method_name| - mod = Module.new do + mod = Module.new do + method_names.each do |method_name| define_method(method_name) do |*args, &block| deprecator.deprecation_warning(method_name, options[method_name]) super(*args, &block) end end - - target_module.prepend(mod) end + + target_module.prepend(mod) end end end