Search code examples
rubyruby-on-rails-3devise

Rails 3.1, Devise signout method dont work with namespace equal to devise_for


in my Rails app have this routes.rb:

 devise_for :admin
 namespace :admin do
     root :to  => 'dashboard#index'
     resources :customers 
 end

If try to logout with link_to('Logout',destroy_admin_session_path, :method => :delete), but rails print "No route matches [GET] "/admin/sign_out""

Is possible to fix without changes routes?


Solution

  • Have resolved by setting GET method for sign_out action, not so secure but works. If anyone has the same problem this is the new routes.rb:

    devise_for :admin, :sign_out_via => [ :get ]
     namespace :admin do
         root :to  => 'dashboard#index'
         resources :customers 
     end
    

    If anyone have more secure fix is welcome