title: How do I generate a normal looking URL for a delete User with Devise, rather than a URL with a format?
body: <p>On the settings page of the user account, I want to add a cancel button. The issue I keep having is that the normal things keep creating a URL that has a <code>.format</code>.</p>
  
  <p>This is what I do in my view:</p>
  
  <pre><code>&lt;%= link_to "Cancel my account", cancel_user_account_path(resource), data: { confirm: "Are you sure you want to cancel your account? All of your memories WILL be lost!" }, method: :delete, class: "btn left" %&gt;
  </code></pre>
  
  <p><strong>Routes</strong></p>
  
  <pre><code>delete "cancel", to: "users#destroy", as: :cancel_user_account
  </code></pre>
  
  <p>Which generates this in my <code>rake routes</code>:</p>
  
  <pre><code>cancel_user_account_path    DELETE  /cancel(.:format)   users#destroy
  </code></pre>
  
  <p>This is what my <code>User#Destroy</code> looks like:</p>
  
  <pre><code>  def destroy
      @user = User.find(params[:id])
      if @user.destroy
        redirect_to root_path, notice: "You have successfully cancelled your account."
      else
        redirect_to :back
      end    
    end
  </code></pre>
  
  <p>That's normal.</p>
  
  <p>But that keeps generating this URL: <code>http://localhost:3000/cancel.148</code></p>
  
  <p>Which generates this error when clicked:</p>
  
  <pre><code>Started DELETE "/cancel.148" for 127.0.0.1 at 2016-01-21 00:30:02 -0500
  Processing by UsersController#destroy as 
    User Load (1.3ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = 148  ORDER BY "users"."id" ASC LIMIT 1
    FamilyTree Load (1.0ms)  SELECT  "family_trees".* FROM "family_trees"  WHERE "family_trees"."user_id" = 148 LIMIT 1
    Node Load (1.6ms)  SELECT "nodes".* FROM "nodes"  WHERE "nodes"."family_tree_id" IN (150)
    Role Load (0.8ms)  SELECT "roles".* FROM "roles" INNER JOIN "users_roles" ON "roles"."id" = "users_roles"."role_id" WHERE "users_roles"."user_id" = $1 AND (((roles.name = 'admin') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL)))  [["user_id", 148]]
  Completed 404 Not Found in 23ms (ActiveRecord: 4.6ms)
  
  ActiveRecord::RecordNotFound - Couldn't find User without an ID:
  </code></pre>
  
  <p>In my error page, I can check the params...and this is what it is sending with the request:</p>
  
  <pre><code>Request parameters  
  {"_method"=&gt;"delete", "action"=&gt;"destroy", "controller"=&gt;"users", "format"=&gt;"148"}
  </code></pre>
  
  <p>I have no idea how to get it to just generate <code>/cancel/148</code>.</p>
  
  <p>I tried many permutations of the routes, including putting it within the <code>devise_for :user</code> block like so:</p>
  
  <pre><code>  devise_scope :user do
      get "settings", to: "devise/registrations#edit"
      delete "logout", to: "devise/sessions#destroy"
      delete "cancel", to: "users#destroy", as: :cancel_user_account
    end
  </code></pre>
  
  <p>I even tried using the other route that devise seems to have generated:</p>
  
  <pre><code>edit_user_registration_path GET /users/edit(.:format)   registrations#edit
                              PATCH   /users(.:format)    registrations#update
                              PUT /users(.:format)    registrations#update
                              DELETE  /users(.:format)    registrations#destroy
  </code></pre>
  
  <p>But even that still generates a weird path: <code>http://localhost:3000/users/edit.148</code>,  which generates a similar error:</p>
  
  <pre><code>ActiveRecord::RecordNotFound at /users/edit.148
  Couldn't find User with 'id'=edit
  </code></pre>
  
  <p>These are the params:</p>
  
  <pre><code>Request parameters  
  {"_method"=&gt;"delete", "action"=&gt;"destroy", "controller"=&gt;"users", "id"=&gt;"edit", "format"=&gt;"148"}
  </code></pre>
  
  <p>What am I doing wrong?</p>