Tristar
Tristar

Reputation: 13

Devise routes issues

I'm trying to adopt devise to my app

Here is the content of Routes.rb

Blog::Application.routes.draw do
  devise_for :users

  devise_scope :user do
    get "admin/login" => "devise/sessions#new"
    delete "admin/logout" => "devise/sessions#destroy"
  end


end

When I try to access /admin/login everything works fine, but when I try to access /admin/logout I get

No route matches [GET] "/admin/logout"

What is wrong here ?

Upvotes: 0

Views: 140

Answers (2)

Arihant Godha
Arihant Godha

Reputation: 2479

If you are using user as a namespace then just check your routes in console by putting rake routes it will give you complete route table along with method.

Upvotes: 0

davidrac
davidrac

Reputation: 10738

You are currently using GET on the URL. You should use DELETE. Specify in the link :method => :delete, which is the proper HTTP verb for destroy action.

Upvotes: 2

Related Questions