简体   繁体   English

设计会议没有路线匹配会破坏路线

[英]No route matches for devise sessions destroy path

I have installed devise to my rails app and was originally able to sign out using <%= link_to('Logout', destroy_user_session_path) %> 我已经将<%= link_to('Logout', destroy_user_session_path) %>安装到我的Rails应用程序中,并且最初能够使用<%= link_to('Logout', destroy_user_session_path) %>

However, somewhere along the line after adding more code and a few gems (paperclip, act_as_votable, social_share_button) I was not able to use the same link. 但是,在添加更多代码和一些gem(回形针,act_as_votable,social_share_button)之后,我无法使用相同的链接。 When I click the link_to I receive the error 当我单击link_to时收到错误

No route matches [GET] "/users/sign_out" 没有路由匹配[GET]“ / users / sign_out”

I have also tried adding config.sign_out_via = :get to my devise.rb file but still got the same error. 我也尝试将config.sign_out_via = :get添加到我的devise.rb文件中,但仍然遇到相同的错误。 What have I done wrong? 我做错了什么?

routes.rb 的routes.rb

    Rails.application.routes.draw do

  devise_for :users, controllers: { registrations: 'users/registrations', sessions: 'users/sessions' }


  root to:'ideas#index'

  get  "/page", to: 'pages#index'

  resources :ideas, only: [:index, :show, :create, :destroy, :new] do
    member do
      put "like", to: "ideas#upvote"
      put "dislike", to: "ideas#downvote"
    end
  end

  resources :comments, only: [:create]
end

sessions controller 会话控制器

    class Users::SessionsController < Devise::SessionsController

  def new
    super
  end


  def create
    super
  end


  def destroy
    super
  end



end

我相信<%= link_to 'Logout', destroy_user_session_path, method: :delete %>是您要寻找的

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

相关问题 没有路线符合“设计/会话” - No route matches “devise/sessions” 设计没有路线匹配会话/用户? - Devise no route matches sessions/users? 没有路由与设计匹配 [POST] &quot;/sessions/user&quot; - No route matches [POST] "/sessions/user" with devise rails3 devise - 没有路由匹配“/ sessions / user” - rails3 devise - no route matches “/sessions/user” Rails设计路由错误 - “无路由匹配”(controller =&gt;“devise / sessions”) - Rails Devise routing error - “No route matches” (controller=>“devise/sessions”) 没有路线与[POST]“ / sessions / user”匹配-登录/注册时-设计 - No route matches [POST] “/sessions/user” - When sign in/sign up - Devise Devise :: Sessions#new中的ActionController :: UrlGenerationError-没有路由匹配 - ActionController::UrlGenerationError in Devise::Sessions#new - No route matches Rails设计帮助路由错误没有路由匹配“/ sessions / user” - Rails devise help routing error No route matches “/sessions/user” 设计命名空间 - ActionController :: RoutingError(无路由匹配{:action =>“new”,:controller =>“devise / sessions”}) - Devise in namespace - ActionController::RoutingError (No route matches {:action=>“new”, :controller=>“devise/sessions”}) 没有符合路线的破坏行动 - No route matches for destroy action
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM