Rails 3 with Devise: No route matches /d/users/sign_out
devise, ruby-on-rails, ruby-on-rails-3
Solution
This appears to be an issue between Devise and Ruby 1.9.2-p290. Updating to Ruby 1.9.3 and running `bundle update` to ensure the latest version of Devise was used; appears to work.
Problem
I am getting the following error when I try to sign out of devise error: No route matches [GET] "/d/users/sign_out" My tag is correct, it is as follows: ``` <%= link_to "Sign Out", destroy_session_path, :method=>:delete %> ``` My route for devise is: ``` devise_for :users, :path_prefix=>"d", :controllers=>{:sessions=>"sessions"} ``` Other routes are: ``` resources :users#For CRUD defined after devise_for like in Devise Wiki ``` With a custom controller sessions for ajax login like on the Devise wiki page: ``` class SessionsController < Devise::SessionsController def create respond_to do |format| format.html{ super } format.json do resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#failure") #resource = warden.authenticate!(:scope => resource_name, :recall => :failure) return sign_in_and_redirect(resource_name, resource) end end end def sign_in_and_redirect(resource_or_scope, resource=nil) scope = Devise::Mapping.find_scope!(resource_or_scope) resource ||= resource_or_scope sign_in(scope, resource) unless warden.user(scope) == resource return render :json => {:success => true, :redirect => stored_location_for(scope) || after_sign_in_path_for(resource)} end def failure return render:json => {:success => false, :errors => ["Login failed."]} end end ``` The devise initializer has: ``` config.sign_out_via = :delete ``` Any ideas on what could be causing the problem? I've searched Google and am still stumped. Update: Here is a screenshot of the rails routes file for the devise users. Sorry, it is small, but you can right-click then view it by itself for a larger screen. Update #2: The jquery_ujs file is included. Update #3: It appears in the console that delete is indeed being passed, but it is jumping from the sessions_controller to / then to d/users/sign_out...Not sure how to fix this. Update #4: When redirecting it goes first to d/users/sign_out as DELETE, as it should. It then redirects to `root_url` which then gives the error `ERROR Errno::ECONNABORTED: An established connection was aborted by the software in your host machine.` It then tries to redirect to d/users/sign_out as GET where it is failing.