Permalink
Browse files

process_action accepts multiple args, even with Callbacks.

  • Loading branch information...
1 parent a2ddf5a commit 8d1a318e9a82f4e437637cfc343fb7c95726905a @apotonick apotonick committed with wycats Dec 29, 2010
Showing with 22 additions and 1 deletion.
  1. +1 −1 actionpack/lib/abstract_controller/callbacks.rb
  2. +21 −0 actionpack/test/abstract/callbacks_test.rb
@@ -13,7 +13,7 @@ module Callbacks
# 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
@@ -243,6 +243,27 @@ class TestHalting < ActiveSupport::TestCase
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

0 comments on commit 8d1a318

Please sign in to comment.