no route matches [GET] "/logout"?

Viewed 824
Rails.application.routes.draw do
  root to: 'users#index'
  get    '/login',   to: 'sessions#new'
  post   '/login',   to: 'sessions#create'
  delete '/logout',  to: 'sessions#destroy'
  resources :users
end

<% if logged_in? %>
    <li><%= link_to "Sign out", logout_path, method: :delete %>
<% end %>

GemFile

gem 'jquery-rails'
gem 'rails', '4.2.2'
gem 'turbolinks'


//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .

Is this a javascript issue? It does not seem to want to recognize method: :delete?

Here is my application.html.erb file:

<!DOCTYPE html>
<html>
<head>
  <title>Workspace</title>
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
</head>
<body>

<%= yield %>

</body>
</html>

Is there an alternative way to pass method: :delete to the route?

3 Answers
Related