I am working a basic rails miniblog tutorial that is based on an older rails (dunno if that is the problem). I am trying to implement user logout (terminate a user session).
I have this in my form:
<%= link_to 'Logout', session_path(current_user), method: :delete %>
and my rake routes table looks good:
session DELETE /sessions/:id(.:format) sessions#destroy
but when I test it on local server, by clicking on 'Logout', I was given this error:
No route matches [GET] "/sessions/1"
It really should not have been a [GET]
request. I checked that I included all the necessary javascript lines and bundle. What went wrong?
p.s. here is my repo: https://github.com/lukexuanliu/CornellBlog
p.p.s. my problem is very similar to this one: Routing Error No route matches [GET] "/microposts/304 - Deleting a Micropost - Michael Hartl's railstutorial.org Chapter 11
but their solution does not work for me. also, my bootstrap css is kind of messed up... dunno if that contributed to the problem