From 7e75dc5d8645b3a63dc4b3df2e624686145500b6 Mon Sep 17 00:00:00 2001 From: Bogdan Gusiev Date: Sun, 25 Dec 2011 22:23:16 +0200 Subject: [PATCH] AS::Callbacks: improved __define_runner performance --- activesupport/lib/active_support/callbacks.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index ba9fb4ecce..2ebafa28dd 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -381,9 +381,8 @@ def __define_runner(symbol) #:nodoc: name = __callback_runner_name(nil, symbol) undef_method(name) if method_defined?(name) - silence_warnings do - runner_method = "_run_#{symbol}_callbacks" - undef_method runner_method if method_defined?(runner_method) + runner_method = "_run_#{symbol}_callbacks" + unless private_method_defined?(runner_method) class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 def #{runner_method}(key = nil, &blk) self.class.__run_callback(key, :#{symbol}, self, &blk)