Skip to content
Browse files

Fix a bug where responders were not working properly on method override.

  • Loading branch information...
1 parent 69a9669 commit 59d1c418be47694a5b79d860bced6f9b7f11f3a8 @josevalim josevalim committed May 24, 2010
View
2 actionpack/lib/action_controller/metal/responder.rb
@@ -217,7 +217,7 @@ def has_errors?
# 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
View
13 actionpack/test/controller/mime_responds_test.rb
@@ -668,6 +668,19 @@ def test_using_resource_for_put_with_html_rerender_on_failure
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

0 comments on commit 59d1c41

Please sign in to comment.
Something went wrong with that request. Please try again.