Devise: Unknown action, Could not find devise mapping for path “/accounts/sign_out”-Collection of common programming errors

I keep getting this error every time I point my browser to “account/sign_out” (GET request):

Unknown action, Could not find devise mapping for path "/accounts/sign_out"

Here’s my route for devise:

devise_for :accounts, :controllers => { :registrations => :accounts  }

It must be something trivial, but I don’t get it. Documentation says devise already provides an action for signing out and binds it to this exact route “/accounts/sign_out”. Please share with me what am I doing wrong?

The output of rake routes shows that the action is mapped:

destroy_account_session GET   /accounts/sign_out(.:format)   {:action=>"destroy", :controller=>"devise/sessions"}
  1. The problem was that in routes.rb I also had resources :accounts route declared before devise_for. Therefore, the solution turned out to be to put it after the devise_for declaration:

    devise_for :accounts, :controllers => { :registrations => :accounts  }
    resources :accounts
    

Originally posted 2013-11-09 22:58:33.