开发者

Signing out of App (that uses Devise) after Implementing Rails_admin (and moving to Rails 3.1)

开发者 https://www.devze.com 2023-04-11 15:05 出处:网络
UPDATE: /* I was able to fix the problem by setting up the asset pipeline as described in Railscasts #282*/

UPDATE: /* I was able to fix the problem by setting up the asset pipeline as described in Railscasts #282*/

I am using Devise for authentication in my app. It was working fine until I added the gem Rails_admin. I also moved to Rails 3.1 in the process so perhaps the problem is with the move to 3.1.

On signing out I get:

"Couldn't find User with id=sign_out"

It traces back to the users_controller's show action and in the params: {"id"=>"sign_out"}

The sign out link is in the application layout:

<%= link_to 'User Sign Out', destroy_user_session_path, :method => :delete %>

The corresponding route:

destroy_user_session DELETE /users/sign_out(.:format)  {:action=>"destroy", :controller=>"devise/sessions"}

This problem seems similar to: Problem Signing Out with Devise on my App except that I am specifying the delete method.

Follow on. . found this method in Devise:

  def after_sign_out_path_for(resource_or_scope)
    root_path
  end

Could anyone tell me how to dig further? I.e. how to find 'resource_or_scope'? The root_path looks fine in the routes.

Here's my routes.开发者_JS百科rb:

Notebook::Application.routes.draw do

  mount RailsAdmin::Engine => '/admin', :as => 'rails_admin'

  devise_for :owners

  match '/user' => 'users#dashboard', :as => :user_root
  match '/customer' => 'customers#dashboard', :as => :customer_root

  match 'users/dashboard' => 'users#dashboard'

  match 'customers/dashboard' => 'customers#dashboard'


  devise_for :users

  devise_for :customers

  resources :users

  resources :customers, :only => [:index, :show, :edit, :update, :destroy]

  root :to => 'misc#landing'
end
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号