aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-19 17:41:17 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-19 18:11:44 -0700
commit67247ca8ee850223193a5fe77f5460aefc0336c0 (patch)
tree8870ef4ccd99585d8a7a1628f4f5e217ad711cc6 /activesupport/lib/active_support
parent36058f45040b5559fd8f6a44a17ead27a6b3d2f7 (diff)
downloadrails-67247ca8ee850223193a5fe77f5460aefc0336c0.tar.gz
rails-67247ca8ee850223193a5fe77f5460aefc0336c0.tar.bz2
rails-67247ca8ee850223193a5fe77f5460aefc0336c0.zip
Corrected new callbacks semantics with regards to using objects for around filters.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/new_callbacks.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/new_callbacks.rb b/activesupport/lib/active_support/new_callbacks.rb
index 9316d6d2b6..f8108780f1 100644
--- a/activesupport/lib/active_support/new_callbacks.rb
+++ b/activesupport/lib/active_support/new_callbacks.rb
@@ -296,9 +296,13 @@ module ActiveSupport
method_name
else
kind, name = @kind, @name
- @klass.send(:define_method, method_name) do
- filter.send("#{kind}_#{name}", self)
- end
+ @klass.send(:define_method, "#{method_name}_object") { filter }
+
+ @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
+ def #{method_name}(&blk)
+ #{method_name}_object.send("#{kind}_#{name}", self, &blk)
+ end
+ RUBY_EVAL
method_name
end
end