Skip to content

Commit

Permalink
process_action accepts multiple args, even with Callbacks.
Browse files Browse the repository at this point in the history
  • Loading branch information
apotonick authored and wycats committed Dec 30, 2010
1 parent 69765aa commit db24701
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/abstract_controller/callbacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions actionpack/test/abstract/callbacks_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit db24701

Please sign in to comment.