1
  <%= link_to "Sign Out", destroy_user_session_path,:method => :delete%>

destroy_user_session DELETE   /users/logout(.:format)                                             devise/sessions#destroy

Routing Error

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

  devise_for :users, path_names: {sign_in: "login", sign_out: "logout"},
             controllers: {omniauth_callbacks: "omniauth_callbacks"}
Hrishikesh Sardar
  • 2,907
  • 4
  • 21
  • 33

1 Answers1

1

Your link_to tag includes :method => :delete as it should but your error message says that the request is being made with the GET method. This won't work, since the route is only for DELETE requests.

Did you click the "sign out" link and immediately get the error message? I'd expect that your answer is no. It's more likely that you're trying to visit /users/logout directly in your browser, without using the link. That would make it a GET request instead of DELETE.

dgmdan
  • 405
  • 6
  • 14
  • actually i got the error message immediately after clicking on signout – Hrishikesh Sardar Aug 09 '13 at 01:13
  • Sorry for the delay. Make sure you're including Rails' external JavaScript that makes delete method links work. See this answer: http://stackoverflow.com/a/4342268/236621 – dgmdan Sep 30 '13 at 18:31