2

I have an application deployed on Heroku. Everything is working fine, except for signing out. When I click the link to sign out I get this error:

"The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved. If you are the application owner check the logs for more information."

For user authentiation I am using of course the devise gem, I have multiple solutions hovering around Stack Overflow however none of them worked for me. Take a look at the files below.

Heroku Logs:

2014-10-04T18:17:49.022165+00:00 app[web.1]: Started GET "/users/sign_out" for 66.65.108.74 at 2014-10-04 18:17:49 +0000
2014-10-04T18:17:49.027680+00:00 app[web.1]: 
2014-10-04T18:17:49.027702+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/railties-4.1.5/lib/rails/rack/logger.rb:20:in `block in call'
2014-10-04T18:17:49.027684+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/users/sign_out"):
2014-10-04T18:17:49.027686+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2014-10-04T18:17:49.027699+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-10-04T18:17:49.027701+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/railties-4.1.5/lib/rails/rack/logger.rb:38:in `call_app'
2014-10-04T18:17:49.027704+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.5/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2014-10-04T18:17:49.027711+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-10-04T18:17:49.027706+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.5/lib/active_support/tagged_logging.rb:68:in `tagged'
2014-10-04T18:17:49.027720+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-10-04T18:17:49.027719+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-10-04T18:17:49.027705+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.5/lib/active_support/tagged_logging.rb:26:in `tagged'
2014-10-04T18:17:49.027708+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/railties-4.1.5/lib/rails/rack/logger.rb:20:in `call'
2014-10-04T18:17:49.027713+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.5/lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
2014-10-04T18:17:49.027710+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-10-04T18:17:49.027715+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
2014-10-04T18:17:49.027724+00:00 app[web.1]:   vendor/ruby-2.1.1/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
2014-10-04T18:17:49.027723+00:00 app[web.1]:   vendor/ruby-2.1.1/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
2014-10-04T18:17:49.027714+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/static.rb:64:in `call'
2014-10-04T18:17:49.027718+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/railties-4.1.5/lib/rails/application.rb:144:in `call'
2014-10-04T18:17:49.027717+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/railties-4.1.5/lib/rails/engine.rb:514:in `call'
2014-10-04T18:17:49.027709+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-10-04T18:17:49.027721+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2014-10-04T18:17:49.027725+00:00 app[web.1]:   vendor/ruby-2.1.1/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
2014-10-04T18:17:49.027727+00:00 app[web.1]: 
2014-10-04T18:17:49.027726+00:00 app[web.1]: 

Routes:

Rails.application.routes.draw do
  root 'listings#index'

  devise_for :users

  resources :listings

  get 'pages/about'
  get 'pages/contact'

end

Navigation:

<ul class="nav navbar-nav navbar-right">
        <% if user_signed_in? %>
          Logged in as <strong><%= current_user.email %></strong>.
          <%= link_to 'Edit profile', edit_user_registration_path, :class => 'navbar-link' %> |
          <%= link_to "Logout", destroy_user_session_path, method: :delete, :class => 'navbar-link'  %>
        <% else %>
          <%= link_to "Sign up", new_user_registration_path, :class => 'navbar-link'  %> |
          <%= link_to "Login", new_user_session_path, :class => 'navbar-link'  %>
        <% end %>
</ul>

EDIT:

Rake Routes:

Prefix Verb   URI Pattern                    Controller#Action
                    root GET    /                              listings#index
        new_user_session GET    /users/sign_in(.:format)       devise/sessions#new
            user_session POST   /users/sign_in(.:format)       devise/sessions#create
    destroy_user_session DELETE /users/sign_out(.: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
                listings GET    /listings(.:format)            listings#index
                         POST   /listings(.:format)            listings#create
             new_listing GET    /listings/new(.:format)        listings#new
            edit_listing GET    /listings/:id/edit(.:format)   listings#edit
                 listing GET    /listings/:id(.:format)        listings#show
                         PATCH  /listings/:id(.:format)        listings#update
                         PUT    /listings/:id(.:format)        listings#update
                         DELETE /listings/:id(.:format)        listings#destroy
             pages_about GET    /pages/about(.:format)         pages#about
           pages_contact GET    /pages/contact(.:format)       pages#contact
illywilly
  • 323
  • 1
  • 5
  • 18

1 Answers1

7

It might be related to jQuery.

Be sure to have the following lines in your application.js file (app/assets/javascripts/application.js), before any other entry:

//= require jquery 
//= require jquery_ujs

A quick fix would be to change the signout method on devise.rb initializer (config/initializers/devise.rb):

config.sign_out_via = :get
  • Hey @bmsatierf thank you for your answer, I really appreciate it. Configuring my initializer file worked perfectly, however requiring jquery and jquery_ujs before any other entry did not work. When I made that switch it seemed to have disabled my bootstrap drop down menus in development. In production however my bootstrap drop down menus do not work at all. – illywilly Oct 05 '14 at 18:39
  • For changes to take effect in production you need to recompile assets, `bundle exec rake assets:precompile` and then restart the server – Ruby Racer Oct 05 '14 at 19:29