Reputation: 4933
My routes
devise_for :users
devise_for :admin_users, ActiveAdmin::Devise.config #I have also tried removing this for any conflicts
resources :users
The sign out link. Routes to /users/sign_out
just fine
<%= link_to "Logout", destroy_user_session_path, :method => :delete %>
Trying to sign out, gives me the error:
Couldn't find User with id=sign_out
If I then remove the resource :users, I get:
The action 'sign_out' could not be found for UsersController
What's wrong? The exact same code worked with Rails 2.3.8 and
the corresponding Devise
version
Logging in etc. works fine.
My setup is:
Upvotes: 3
Views: 2523
Reputation: 113280
First of all, using the same path for UsersController and Devise isn't a great idea. I would suggest using a path like '/accounts' for Devise.
But this probably isn't the cause of your sign out problem, as devise_for :users
comes before resources :users
in routes.rb. What seems to be the cause is, unless there'a typo in the question, that there's no comma after destroy_user_session_path
. :method => :delete
will be interpreted as a parameter to destroy_user_session_path
unless there's a comma.
Also, make sure you're including jquery and jquery_ujs in application.js, as these are required for :method => :delete
to work.
Upvotes: 4