diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-07-15 21:55:28 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-07-15 22:01:02 -0500 |
commit | be078ee162fcae883a5621a30929879cd783a238 (patch) | |
tree | 6f6b6f31fef96c98771aff9f7a9da5cc0836da51 /activesupport/lib | |
parent | f4f6e57e8c2a446a4a600576f0caf0fb8921ba13 (diff) | |
download | rails-be078ee162fcae883a5621a30929879cd783a238.tar.gz rails-be078ee162fcae883a5621a30929879cd783a238.tar.bz2 rails-be078ee162fcae883a5621a30929879cd783a238.zip |
Run callbacks from object's metaclass [#575 state:resolved]
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 9c59b7ac76..f125a56246 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -269,7 +269,15 @@ module ActiveSupport # pass # stop def run_callbacks(kind, options = {}, &block) - self.class.send("#{kind}_callback_chain").run(self, options, &block) + callback_chain_method = "#{kind}_callback_chain" + + # Meta class inherits Class so we don't have to merge it in 1.9 + if RUBY_VERSION >= '1.9' + metaclass.send(callback_chain_method).run(self, options, &block) + else + callbacks = self.class.send(callback_chain_method) | metaclass.send(callback_chain_method) + callbacks.run(self, options, &block) + end end end end |