开发者

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

routes.rb =>

Sendemail::Applicatio开发者_运维知识库n.routes.draw do
    devise_for :users

    get "user/index"

    get "home/index"

    root :to => 'home#index'
end

rake routes =>

        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"}

When i type rails server i get this message every time =>

/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

For "http://0.0.0.0:3000/users/sign_out"

Routing Error

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

What should i do to fix this problem ?


Notice how your routes say /users/sign_out is a DELETE request. Most browsers do not make DELETE requests by default. Just going to that URL would be a GET request to /users/sign_out.

This how to add sign out links should help you get it working.


Add :method => :delete to your signout link.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜