diff options
author | José Valim <jose.valim@gmail.com> | 2011-11-11 02:02:59 -0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-11-11 02:02:59 -0800 |
commit | 7352efa6f87536af2bc22bef3f005ddfb793acc3 (patch) | |
tree | ee767d55144c389bc34f371a52c478085e942cdc /activesupport | |
parent | 2e5c4717ba8aca8459637f9413b100ed58a6bcd1 (diff) | |
parent | 08cc49b919cfa43a19f55b761dba56bc3673b6b7 (diff) | |
download | rails-7352efa6f87536af2bc22bef3f005ddfb793acc3.tar.gz rails-7352efa6f87536af2bc22bef3f005ddfb793acc3.tar.bz2 rails-7352efa6f87536af2bc22bef3f005ddfb793acc3.zip |
Merge pull request #3607 from bogdan/callbacks
AS::Callbacks.__run_keyed_callback: remove unused cache
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 31737d54cb..962299bf7c 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -394,16 +394,12 @@ module ActiveSupport # def __run_keyed_callback(key, kind, object, &blk) #:nodoc: name = "_run__#{self.name.hash.abs}__#{kind}__#{key.hash.abs}__callbacks" - unless respond_to?(name) - @_keyed_callbacks ||= {} - @_keyed_callbacks[name] ||= begin - str = send("_#{kind}_callbacks").compile(name, object) - class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 - def #{name}() #{str} end - protected :#{name} - RUBY_EVAL - true - end + unless object.respond_to?(name) + str = send("_#{kind}_callbacks").compile(name, object) + class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 + def #{name}() #{str} end + protected :#{name} + RUBY_EVAL end object.send(name, &blk) end |