1

all the things were working fine with devise's Registration and session related but when I added devise invitable in the project, after that my session controller's destroy functionality not working. when I clicked on logout button the request sent to here

Started DELETE "/logout" for 127.0.0.1 at 2018-12-15 06:49:20 +0500
Processing by Devise::SessionsController#destroy as HTML
  Parameters:{"authenticity_token"=>"Z9dNZ0yj+pIFkPKaU/Ir7h99b4dYse3KCaQ7GYUm3g6ZAgZVF+B+WmeKouzNwJOcimtUjDuyb6jY3qdSZqC8aw=="}
  User Load (1.0ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 1], ["LIMIT", 1]]
Completed 200 OK in 7ms (ActiveRecord: 1.0ms)

but you can see here is not find any resource and redirect page, there for I getting blank page, so after that I go to any url this show user logged in.

here is my route.rb code for it:

devise_for :users, path: '', path_names: {
 sign_in: 'login',
 sign_out: 'logout',
 sign_up: 'register',
 password: 'reset',
 edit: 'account'
},
controllers: {
 registrations: 'users/registrations',
 confirmations: 'users/confirmations',
 omniauth_callbacks: 'users/omniauth_callbacks',
 invitations: 'users/invitations'
}

and this is my logout link:

<%= link_to destroy_user_session_path, method: :delete do %>
    <span class="text">Logout</span>
<% end %>

Please give me the solution and save my life, because I tried many things to resolve it but not successful.

Rana. Amir
  • 187
  • 3
  • 15
  • Have you tried defining a `after_sign_out_path_for` method in your application controller? – Mark Merritt Dec 15 '18 at 02:19
  • @MarkMerritt, yes I tried but fruitful because I think the resource couldn't find, you can see `log` in the `console`. – Rana. Amir Dec 15 '18 at 02:22
  • this one. `def after_sign_out_path_for(resource_or_scope) root_path end` – Rana. Amir Dec 15 '18 at 02:27
  • yeah, I'm damn sure because my this branch have a problem when I switched into my `master` branch all are going fine and my `current` branch is 1 step ahead from master branch. – Rana. Amir Dec 15 '18 at 02:32

0 Answers0