The signout does not work. Here is the view:
<%= link_to ‘Sign out’, session_path, method: :delete %>
The following is generated: Sign out
Unfortunately this results in a get instead of a delete. I have Rails 4 gem installed but have specified Rails 3.1.12
Rake routes:
root GET / {:controller=>"homes", :action=>"show"}
session POST /session(.:format) {:action=>"create", :controller=>"sessions"}
new_session GET /session/new(.:format) {:action=>“new”, :controller=>“sessions”}
DELETE /session(.:format) {:action=>“destroy”, :controller=>“sessions”}
users POST /users(.:format) {:action=>“create”, :controller=>“users”}
new_user GET /users/new(.:format) {:action=>“new”, :controller=>“users”}
@Ray_Hooker, I believe this is caused by the strong_parameters gem. Try removing it from your gemfile as well as the references to it in application.html.erb.
bundle and restart your server and the link should now send a DELETE request
EDIT strong_parameters is a gem that handles permissions to set attributes on an object. I meant turbolinks here.
:facepalm: I meant turbolinks, not strong_parameters (you want that). There is probably a reference to it in application.html.erb, application.js, and possibly still in your Gemfile
Joel, I suspect you are right to look at Javascript but there is no turobolinks. There is only jquery, jquery_ujs and tree. OTOH as I tried share before, the link_to is translated to:
So note that it is an html data item. I believe that the Rails routing is supposed to use that… but I don’t see evidence that it was passed in the get request. I am not sure what whether there is a Javascript helper needed to make that happen such as for rails.js and the remote-data tag.
So that I could continue with the video, I did update the routes to add a get route:
get “sessions/signoutsession”
I added a signoutsession method to sessions to delete the session and updated the view to call it. I still need to find the problem since this is not how it should be.