From db24701abed4858d9b326bbaaf5c08726e4ced75 Mon Sep 17 00:00:00 2001 From: Nick Sutterer Date: Wed, 29 Dec 2010 23:56:58 +0100 Subject: process_action accepts multiple args, even with Callbacks. --- actionpack/lib/abstract_controller/callbacks.rb | 2 +- actionpack/test/abstract/callbacks_test.rb | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/actionpack/lib/abstract_controller/callbacks.rb b/actionpack/lib/abstract_controller/callbacks.rb index f169ab7c3a..95992c2698 100644 --- a/actionpack/lib/abstract_controller/callbacks.rb +++ b/actionpack/lib/abstract_controller/callbacks.rb @@ -13,7 +13,7 @@ module AbstractController # Override AbstractController::Base's process_action to run the # process_action callbacks around the normal behavior. - def process_action(method_name) + def process_action(method_name, *args) run_callbacks(:process_action, method_name) do super end diff --git a/actionpack/test/abstract/callbacks_test.rb b/actionpack/test/abstract/callbacks_test.rb index 2d02078020..5308fc849b 100644 --- a/actionpack/test/abstract/callbacks_test.rb +++ b/actionpack/test/abstract/callbacks_test.rb @@ -245,6 +245,27 @@ module AbstractController assert_equal "Success", controller.response_body end end + + class CallbacksWithArgs < ControllerWithCallbacks + set_callback :process_action, :before, :first + + def first + @text = "Hello world" + end + + def index(text) + self.response_body = @text + text + end + end + + class TestCallbacksWithArgs < ActiveSupport::TestCase + test "callbacks still work when invoking process with multiple args" do + controller = CallbacksWithArgs.new + result = controller.process(:index, " Howdy!") + assert_equal "Hello world Howdy!", controller.response_body + end + end + end end -- cgit v1.2.3