<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Rails Forum - Ruby on Rails Help and Discussion Forum - Redirect After Delete [SOLVED]]]></title>
		<link>http://railsforum.com/viewtopic.php?id=52242</link>
		<description><![CDATA[The most recent posts in Redirect After Delete [SOLVED].]]></description>
		<lastBuildDate>Thu, 31 Jan 2013 18:17:50 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Redirect After Delete [SOLVED]]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=158713#p158713</link>
			<description><![CDATA[<p>For posterity, this hack is what was required for the above example:<br /></p><div class="codebox"><pre><code>  resources :users
  delete &#039;users/:id/edit&#039; =&gt; &#039;users#edit&#039;, :via =&gt; :get</code></pre></div><p>For whatever reason, rails is stuck on using the DELETE verb after a DELETE redirect, even though the browser specifically uses GET. This hack tells rails to use GET whenever it DELETEs the users/edit resource. I consider this hack a workaround to a bug in rails.</p>]]></description>
			<author><![CDATA[dummy@example.com (SingleShot)]]></author>
			<pubDate>Thu, 31 Jan 2013 18:17:50 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=158713#p158713</guid>
		</item>
		<item>
			<title><![CDATA[Redirect After Delete [SOLVED]]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=158686#p158686</link>
			<description><![CDATA[<p>I have several cases where I want to do a redirect after a DELETE. From the browser&#039;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.</p><p>The path the DELETE is issued on might look like this:<br /></p><div class="codebox"><pre><code>user_authorization_path(@user, authorization)</code></pre></div><p> The redirect in my controller might look like this:<br /></p><div class="codebox"><pre><code>redirect_to edit_user_path(params[:user_id])</code></pre></div><p>My browser&#039;s debugger sees this:</p><div class="codebox"><pre><code>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 Found</code></pre></div><p>Rails&#039; log shows this:</p><div class="codebox"><pre><code>Started DELETE &quot;/users/1/authorizations/12&quot;...
...
Redirected to http://localhost:3000/users/1/edit
Completed 302 Found in 8ms (ActiveRecord: 0.2ms)

Started DELETE &quot;/users/1/edit&quot;...

ActionController::RoutingError (No route matches DELETE &quot;/users/1/edit&quot;)</code></pre></div><p>Manually doing a GET on the redirect URL works fine.</p><p>Does Rails not support delete-redirect-get? Thoughts on what the problem could be? Thanks.</p>]]></description>
			<author><![CDATA[dummy@example.com (SingleShot)]]></author>
			<pubDate>Thu, 31 Jan 2013 01:00:40 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=158686#p158686</guid>
		</item>
	</channel>
</rss>
