Topic: Redirect After Delete [SOLVED]
I have several cases where I want to do a redirect after a DELETE. From the browser's point of view the interaction looks correct - the DELETE is issued, a 302 is returned pointing at the correct redirect URL, and the browser issues a GET on that URL. However on the Rails side, Rails appears to be trying to do a DELETE on the redirect URL.
The path the DELETE is issued on might look like this:
user_authorization_path(@user, authorization) The redirect in my controller might look like this:
redirect_to edit_user_path(params[:user_id])My browser's debugger sees this:
Request URL:http://localhost:3000/users/1/authorizations/12
Request Method:DELETE
Status Code:302 Found
Request URL:http://localhost:3000/users/1/edit
Request Method:GET
Status Code:404 Not FoundRails' log shows this:
Started DELETE "/users/1/authorizations/12"...
...
Redirected to http://localhost:3000/users/1/edit
Completed 302 Found in 8ms (ActiveRecord: 0.2ms)
Started DELETE "/users/1/edit"...
ActionController::RoutingError (No route matches DELETE "/users/1/edit")Manually doing a GET on the redirect URL works fine.
Does Rails not support delete-redirect-get? Thoughts on what the problem could be? Thanks.
Last edited by SingleShot (2013-01-31 14:30:34)