title: Devise routing: is there a way to remove a route from Rails.application.routes?
body: <p><code>devise_for</code> creates routes including a DELETE route, which we want to remove, and <code>devise_for</code> doesn't support an <code>:except</code> or <code>:only</code> option.</p>
  
  <p>How can I remove a route from <code>Rails.application.routes</code>?  Either in the <code>draw</code> block, or afterward?</p>
  
  <hr>
  
  <p>Here are details of a bug, which was the reason we needed to remove the route.</p>
  
  <ul>
  <li><p>we were issuing a DELETE request to a custom UJS controller action</p></li>
  <li><p>in the controller action we were removing what we wanted to, then doing a 302 redirect.  This was a bad idea, and we have since corrected it by returning some JSON instead.</p></li>
  <li>some clients, upon receiving the 302 would issue a new DELETE request to the redirect, which routes to a Devise delete route!  Thereby inadvertantly deleting the person! Yikes. We were assuming this would be a GET.   Bad assumption.  </li>
  </ul>
  
  <p>This bug has been fixed, but i would like to remove the route nonetheless. </p>
  
  <hr>
  
  <p>Here is what I did in the end, which was suggested by the bounty-winner in his quote from Jose´ Valim:</p>
  
  <p>In <code>config/routes.rb</code>, I added this above the <code>devise_for</code> call, which sets up the rest of my <code>'people'</code> routes:</p>
  
  <pre><code>delete '/person', :to =&gt; 'people#destroy'
  </code></pre>
  
  <p>Then in my existing <code>people_controller.rb</code>, I added a no-op method:</p>
  
  <pre><code>def destroy
    render :nothing =&gt; true
  end
  </code></pre>
  
  <p>I'm still a little irked that there isn't a simple way to just remove the route from the RouteSet.  Also, the <code>delete</code> route still exists for the devise controller, but it won't get called because rails looks for the first match in <code>config/routes.rb</code> and returns it.</p>