I get the following routing error when I click on "logout":
No route matches [GET] "/logout"
This is my application.html.erb file:
<% if session[:user_id] %>
<%= link_to 'Logout', logout_path, :method => :delete %>
<% end %>
This is my routes.rb file:
get 'admin' => 'admin#index'
controller :sessions do
get 'login' => :new
post 'login'=> :create
delete 'logout' => :destroy
end
get "sessions/create"
get "sessions/destroy"
Does anybody know how to solve this problem?
delete 'logout' => :destroy
toget 'logout' => :destroy
this will work.