Reputation: 168
I am creating a login-logout link. I have used my devise for user and getting the following error.
Showing /home/sushmitha/ground/remote_modals_demo-master/app/views/layouts/_header.html.erb where line #9 raised:
undefined local variable or method `delete' for #<#:0x00007f3920c61e38>
//_header.html.erb
<header class="navbar navbar-fixed-top navbar-inverse">
<div class="container">
<h1><%= link_to "Cricket", root_path, id: "logo" %></h1>
<nav>
<ul class="nav navbar-nav navbar-right">
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "Help", '#' %></li>
<% if user_signed_in? %>
<li><%= link_to "Sign out", destroy_user_session_path, method:delete %></li>
<% else %>
<li><%= link_to "Log in", user_session_path %></li>
<% end %>
</ul>
</nav>
</div>
</header>
user routes
Prefix Verb URI Pattern Controller#Action
new_user_session GET /users/sign_in(.:format) users/sessions#new
user_session POST /users/sign_in(.:format) users/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) users/sessions#destroy
cancel_user_registration GET /users/cancel(.:format) users/registrations#cancel
new_user_registration GET /users/sign_up(.:format) users/registrations#new
edit_user_registration GET /users/edit(.:format) users/registrations#edit
user_registration PATCH /users(.:format) users/registrations#update
PUT /users(.:format) users/registrations#update
DELETE /users(.:format) users/registrations#destroy
POST /users(.:format) users/registrations#create
users GET /users(.:format) users#index
POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PATCH /users/:id(.:format) users#update
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
Upvotes: 0
Views: 608