aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Sutterer <apotonick@gmail.com>2010-12-29 23:56:58 +0100
committerwycats <wycats@gmail.com>2010-12-29 16:37:10 -0800
commitdb24701abed4858d9b326bbaaf5c08726e4ced75 (patch)
tree3c27b928cedb818a28c0fa8da376493002d42917
parent69765aad8bcc853e7ab6b0e79f4edece2cdd7fe2 (diff)
downloadrails-db24701abed4858d9b326bbaaf5c08726e4ced75.tar.gz
rails-db24701abed4858d9b326bbaaf5c08726e4ced75.tar.bz2
rails-db24701abed4858d9b326bbaaf5c08726e4ced75.zip
process_action accepts multiple args, even with Callbacks.
-rw-r--r--actionpack/lib/abstract_controller/callbacks.rb2
-rw-r--r--actionpack/test/abstract/callbacks_test.rb21
2 files changed, 22 insertions, 1 deletions
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