I'm able to sign out easily on my localhost in development but I'm unable to sign out on production mode on heroku using devise. After going through logs I found out that users/sign_out
was being called with GET method.
This is the code generated by heroku server for logout button:
<a rel="nofollow" data-method="delete" href="/users/sign_out">Logout</a>
I made a custom route for the GET method to sign out but that isn't following the RESTful approach. Here is my routes file:
Rails.application.routes.draw do
resources :posts do
resources :post_comments
end
devise_for :users, controllers: {
sessions: 'users/sessions',
registrations: 'users/registrations'
}
devise_scope :user do
get 'users/sign_out', to: 'users/sessions#destroy'
end
root 'posts#index'
end
How do I fix this to use DELETE method?