更新:/ *我能够通过设置资产管道解决问题,如Railscasts #282 * /
中所述我在我的应用中使用Devise进行身份验证。它工作正常,直到我添加了宝石Rails_admin。我也在这个过程中转移到了Rails 3.1,所以问题可能在于移动到3.1。
退出时我得到:
“找不到ID = sign_out的用户”
它追溯到users_controller的show动作和params:{"id"=>"sign_out"}
退出链接位于应用程序布局中:
<%= link_to 'User Sign Out', destroy_user_session_path, :method => :delete %>
相应的路线:
destroy_user_session DELETE /users/sign_out(.:format) {:action=>"destroy", :controller=>"devise/sessions"}
此问题类似于:Problem Signing Out with Devise on my App,但我指定了删除方法。
继续。 。在Devise中找到了这个方法:
def after_sign_out_path_for(resource_or_scope)
root_path
end
有谁能告诉我如何进一步挖掘?即如何找到'resource_or_scope'? root_path在路由中看起来很好。
这是我的routes.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