Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

process_action accepts multiple args, even with Callbacks.

  • Loading branch information...
commit db24701abed4858d9b326bbaaf5c08726e4ced75 1 parent 69765aa
Nick Sutterer apotonick authored wycats committed
2  actionpack/lib/abstract_controller/callbacks.rb
View
@@ -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
21 actionpack/test/abstract/callbacks_test.rb
View
@@ -245,6 +245,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
Please sign in to comment.
Something went wrong with that request. Please try again.