No route matches [GET] “/users/sign_out”

前端 未结 19 1481
谎友^
谎友^ 2020-12-04 18:44

Here is my actual error: No route matches [GET] \"/members/sign_out\" Since most people will use \"users\" I thought it would be more helpful to have that in th

19条回答
  •  有刺的猬
    2020-12-04 18:58

    Maybe that will help somebody. Upgraded from Rails 3.0 to 3.1 and found this problem. This fixed it for me:

    routes.rb:
    devise_for: users

    devise.rb:
    config.sign_out_via = :delete

    application.html.erb:

    <%= javascript_include_tag "application" %>     
    

    * not :defaults

    _login_items.html.erb:

    <%= link_to('Logout', destroy_user_session_path, :method => :delete) %>
    

    app/assets/javascripts/application.js

    //= require jquery
    //= require jquery-ui
    //= require jquery_ujs
    //= require_tree .
    

    and I had in javascript/ jquery.js, jquery_ujs.js from 3.0 version that I've removed.

提交回复
热议问题