From 59d1c418be47694a5b79d860bced6f9b7f11f3a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 24 May 2010 13:12:40 +0200 Subject: Fix a bug where responders were not working properly on method override. --- actionpack/lib/action_controller/metal/responder.rb | 2 +- actionpack/test/controller/mime_responds_test.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/actionpack/lib/action_controller/metal/responder.rb b/actionpack/lib/action_controller/metal/responder.rb index 6ad9a23542..22bdcd0f3c 100644 --- a/actionpack/lib/action_controller/metal/responder.rb +++ b/actionpack/lib/action_controller/metal/responder.rb @@ -217,7 +217,7 @@ module ActionController #:nodoc: # the verb is POST. # def default_action - @action ||= ACTIONS_FOR_VERBS[request.method_symbol] + @action ||= ACTIONS_FOR_VERBS[request.request_method_symbol] end end end diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index c8ba8bcaf3..d654338dba 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -668,6 +668,19 @@ class RespondWithControllerTest < ActionController::TestCase end end + def test_using_resource_for_put_with_html_rerender_on_failure_even_on_method_override + with_test_route_set do + errors = { :name => :invalid } + Customer.any_instance.stubs(:errors).returns(errors) + @request.env["rack.methodoverride.original_method"] = "POST" + put :using_resource + assert_equal "text/html", @response.content_type + assert_equal 200, @response.status + assert_equal "Edit world!\n", @response.body + assert_nil @response.location + end + end + def test_using_resource_for_put_with_xml_yields_ok_on_success @request.accept = "application/xml" put :using_resource -- cgit v1.2.3