繁体   English   中英

Ruby on Rails设计http://0.0.0.0:3000/users/sign_out收到路由错误

[英]Ruby on Rails devise http://0.0.0.0:3000/users/sign_out gets routing error

route.rb =>

Sendemail::Application.routes.draw do
    devise_for :users

    get "user/index"

    get "home/index"

    root :to => 'home#index'
end

耙路=>

        new_user_session GET    /users/sign_in(.:format)          {:action=>"new", :controller=>"devise/sessions"}
            user_session POST   /users/sign_in(.:format)          {:action=>"create", :controller=>"devise/sessions"}
    destroy_user_session DELETE /users/sign_out(.:format)         {:action=>"destroy", :controller=>"devise/sessions"}
           user_password POST   /users/password(.:format)         {:action=>"create", :controller=>"devise/passwords"}
       new_user_password GET    /users/password/new(.:format)     {:action=>"new", :controller=>"devise/passwords"}
      edit_user_password GET    /users/password/edit(.:format)    {:action=>"edit", :controller=>"devise/passwords"}
                         PUT    /users/password(.:format)         {:action=>"update", :controller=>"devise/passwords"}
cancel_user_registration GET    /users/cancel(.:format)           {:action=>"cancel", :controller=>"devise/registrations"}
       user_registration POST   /users(.:format)                  {:action=>"create", :controller=>"devise/registrations"}
   new_user_registration GET    /users/sign_up(.:format)          {:action=>"new", :controller=>"devise/registrations"}
  edit_user_registration GET    /users/edit(.:format)             {:action=>"edit", :controller=>"devise/registrations"}
                         PUT    /users(.:format)                  {:action=>"update", :controller=>"devise/registrations"}
                         DELETE /users(.:format)                  {:action=>"destroy", :controller=>"devise/registrations"}
       user_confirmation POST   /users/confirmation(.:format)     {:action=>"create", :controller=>"devise/confirmations"}
   new_user_confirmation GET    /users/confirmation/new(.:format) {:action=>"new", :controller=>"devise/confirmations"}
                         GET    /users/confirmation(.:format)     {:action=>"show", :controller=>"devise/confirmations"}
              user_index GET    /user/index(.:format)             {:controller=>"user", :action=>"index"}
              home_index GET    /home/index(.:format)             {:controller=>"home", :action=>"index"}
                    root        /                                 {:controller=>"home", :action=>"index"}

当我输入Rails服务器时,每次都会收到此消息=>

/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV

对于“ http://0.0.0.0:3000/users/sign_out”

Routing Error

No route matches [GET] "/users/sign_out"

我应该怎么做才能解决这个问题?

请注意,您的路线说/ users / sign_out是DELETE请求。 默认情况下,大多数浏览器不会发出DELETE请求。 只需转到该URL,便是对/ users / sign_out的GET请求。

这种添加退出链接的方法应该可以帮助您正常运行。

:method => :delete添加到您的注销链接。

暂无
暂无

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

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