繁体   English   中英

错误:注销链接中未定义的局部变量或方法“删除”

[英]Error :undefined local variable or method `delete' in logout link

我正在创建一个登录-注销链接。 我已经为用户使用了我的设计,并收到以下错误。

显示/home/sushmitha/ground/remote_modals_demo-master/app/views/layouts/_header.html.erb,其中第9行出现:

#<#:0x00007f3920c61e38>的未定义局部变量或方法'delete'

//_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>

用户路线

         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

它应该是方法::delete。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM