diff options
-rw-r--r-- | actionpack/test/controller/filters_test.rb | 10 | ||||
-rw-r--r-- | activesupport/lib/active_support/new_callbacks.rb | 17 |
2 files changed, 11 insertions, 16 deletions
diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index df0a9dbfb0..b930ff4997 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -876,10 +876,12 @@ class YieldingAroundFiltersTest < ActionController::TestCase assert_raise(After) { test_process(controller,'raises_after') } end - def test_with_method - controller = ControllerWithFilterMethod - assert_nothing_raised { test_process(controller,'no_raise') } - assert_raise(After) { test_process(controller,'raises_after') } + for_tag(:old_base) do + def test_with_method + controller = ControllerWithFilterMethod + assert_nothing_raised { test_process(controller,'no_raise') } + assert_raise(After) { test_process(controller,'raises_after') } + end end def test_with_proc diff --git a/activesupport/lib/active_support/new_callbacks.rb b/activesupport/lib/active_support/new_callbacks.rb index 6023fc1170..237a285665 100644 --- a/activesupport/lib/active_support/new_callbacks.rb +++ b/activesupport/lib/active_support/new_callbacks.rb @@ -180,9 +180,10 @@ module ActiveSupport filter = <<-RUBY_EVAL unless halted result = #{@filter} - halted ||= (#{terminator}) + halted = (#{terminator}) end RUBY_EVAL + [@compiled_options[0], filter, @compiled_options[1]].compact.join("\n") else # Compile around filters with conditions into proxy methods @@ -201,7 +202,7 @@ module ActiveSupport # end name = "_conditional_callback_#{@kind}_#{next_id}" - txt = <<-RUBY_EVAL + txt, line = <<-RUBY_EVAL, __LINE__ def #{name}(halted) #{@compiled_options[0] || "if true"} && !halted #{@filter} do @@ -212,7 +213,7 @@ module ActiveSupport end end RUBY_EVAL - @klass.class_eval(txt) + @klass.class_eval(txt, __FILE__, line) "#{name}(halted) do" end end @@ -291,15 +292,7 @@ module ActiveSupport " self, Proc.new " else "" - end - when Method - @klass.send(:define_method, "#{method_name}_method") { filter } - @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 - def #{method_name}(&blk) - #{method_name}_method.call(self, &blk) - end - RUBY_EVAL - method_name + end when String @klass.class_eval <<-RUBY_EVAL def #{method_name} |