aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/callbacks.rb
diff options
context:
space:
mode:
authorBogdan Gusiev <agresso@gmail.com>2011-12-25 22:23:16 +0200
committerSergey Nartimov <just.lest@gmail.com>2012-01-03 22:14:33 +0300
commit4e8286fe124dd5a54960fce191b86fa00010cd3b (patch)
tree11c8f88f7ab0d9c306c5bf6c3a6f72f632f2cd41 /activesupport/lib/active_support/callbacks.rb
parent9f8f4c28718d5688f18140111eac517a5ef8142e (diff)
downloadrails-4e8286fe124dd5a54960fce191b86fa00010cd3b.tar.gz
rails-4e8286fe124dd5a54960fce191b86fa00010cd3b.tar.bz2
rails-4e8286fe124dd5a54960fce191b86fa00010cd3b.zip
AS::Callbacks: improved __define_runner performance
Diffstat (limited to 'activesupport/lib/active_support/callbacks.rb')
-rw-r--r--activesupport/lib/active_support/callbacks.rb5
1 files 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 @@ module ActiveSupport
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)