I have methodically been working thru the Agile Web Development with Rails book. No problems so far until I came across the development of logout using the sessions controller. I am simply trying to get the destroy method to work in the session controller. Here is what I have:
sessions_controller.rb
def destroy
session[:user_id] = nil
redirect_to store_url, :notice => "Logged out"
end
routes.rb
controller :sessions do
get 'login' => :new
post 'login' => :create
delete 'logout' => :destroy
end
I reset the server and can login using localhost:3000/login BUT if i try localhost:3000/logout i get the following routing error: No route matches “/logout”
Any help is greatly appreciated as I have been digging thru the web trying to find a answer.
I believe
should be
or
depending on how you are handling the behavior. Most likely you want
get.