diff options
author | Yehuda Katz <wycats@gmail.com> | 2009-03-17 18:05:08 -0700 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2009-03-17 18:05:08 -0700 |
commit | fb626ee39065512928c90c396db8b5476c5a7aeb (patch) | |
tree | b294fee914e3b3e2938a1374fff17043ae5d4118 /activesupport/lib/active_support | |
parent | e6e3e3dfbc2dda1e25dea75d8d2c746b192638e9 (diff) | |
download | rails-fb626ee39065512928c90c396db8b5476c5a7aeb.tar.gz rails-fb626ee39065512928c90c396db8b5476c5a7aeb.tar.bz2 rails-fb626ee39065512928c90c396db8b5476c5a7aeb.zip |
Rework NewCallbacks to not require method_missing
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/new_callbacks.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/new_callbacks.rb b/activesupport/lib/active_support/new_callbacks.rb index 65d2ddac32..b93057fe27 100644 --- a/activesupport/lib/active_support/new_callbacks.rb +++ b/activesupport/lib/active_support/new_callbacks.rb @@ -353,7 +353,15 @@ module ActiveSupport str = <<-RUBY_EVAL def _run_#{symbol}_callbacks(key = nil) if key - send("_run__\#{self.class.name.split("::").last}__#{symbol}__\#{key}__callbacks") { yield if block_given? } + name = "_run__\#{self.class.name.split("::").last}__#{symbol}__\#{key}__callbacks" + + if respond_to?(name) + send(name) { yield if block_given? } + else + self.class._create_and_run_keyed_callback( + self.class.name.split("::").last, + :#{symbol}, key, self) { yield if block_given? } + end else #{str} end |