aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-25 12:37:50 -0800
committerJosé Valim <jose.valim@gmail.com>2011-12-25 12:37:50 -0800
commite33c94675336344c31d9701cdd20b026354339e7 (patch)
treeca2d983fa86c78d29bbcc1db5ba737048ade56aa
parent748725e9ce081f6517c68d8f74d254e2079d0d79 (diff)
parent7e75dc5d8645b3a63dc4b3df2e624686145500b6 (diff)
downloadrails-e33c94675336344c31d9701cdd20b026354339e7.tar.gz
rails-e33c94675336344c31d9701cdd20b026354339e7.tar.bz2
rails-e33c94675336344c31d9701cdd20b026354339e7.zip
Merge pull request #4189 from bogdan/non_keyed_callbacks
AS::Callbacks: improved __define_runner performance
-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)