Reputation: 6998
I hate to post another topic about this since there seem to be about a dozen but I can't find any that solve this issue for me.
In my application.html.erb
I have:
<% if user_signed_in? %>
Logged in as <strong><%= current_user.email %></strong>.
<%= link_to 'Settings', edit_user_registration_path %> |
<%= link_to "Log out", destroy_user_session_path, method: :delete %>
<% else %>
<%= link_to "Sign up", new_user_registration_path %> |
<%= link_to "Log in", new_user_session_path %>
<% end %>
routes
look like this:
devise_for :users,
path_names: {sign_in: "login", sign_out: "logout"}
resources :users
resources :addresses
root 'users#index'
get 'dashboard', to: "users#dashboard"
And my local log looks like this:
started GET "/users/logout" for 127.0.0.1 at 2013-10-21 17:47:21 -0700
Processing by UsersController#show as HTML
Parameters: {"id"=>"logout"}
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
Rendered users/show.erb within layouts/application (1.2ms)
So like many other topics, it's trying to pass logout
as the id
. I have the :delete
in my application.html.erb
link, so that's not it.
This is what's in my application.js
:
//= require jquery
//= require jquery_ujs
//= require_tree .
That looks good.
Any ideas? I'm stumped...
Edit: Output from rake routes
Prefix Verb URI Pattern Controller#Action
new_user_session GET /users/login(.:format) devise/sessions#new
user_session POST /users/login(.:format) devise/sessions#create
destroy_user_session DELETE /users/logout(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PATCH /users(.:format) devise/registrations#update
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
users GET /users(.:format) users#index
POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PATCH /users/:id(.:format) users#update
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
addresses GET /addresses(.:format) addresses#index
POST /addresses(.:format) addresses#create
new_address GET /addresses/new(.:format) addresses#new
edit_address GET /addresses/:id/edit(.:format) addresses#edit
address GET /addresses/:id(.:format) addresses#show
PATCH /addresses/:id(.:format) addresses#update
PUT /addresses/:id(.:format) addresses#update
DELETE /addresses/:id(.:format) addresses#destroy
root GET / users#index
dashboard GET /dashboard(.:format) users#dashboard
send_im_home_text GET /im_home(.:format) users#im_home
Upvotes: 4
Views: 4726
Reputation: 485
Missing <%= javascript_include_tag :application %>
in application.html.erb
as mentioned in comments.
Upvotes: 2