2

更新:/* 我能够通过设置资产管道来解决问题,如Railscasts #282中所述*/

我在我的应用程序中使用设计进行身份验证。在我添加 gem Rails_admin 之前它工作正常。在此过程中,我还迁移到 Rails 3.1,所以问题可能出在迁移到 3.1 上。

退出时我得到:

“找不到 id=sign_out 的用户”

它可以追溯到 users_controller 的显示操作和参数:{"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除了我指定了删除方法。

跟着。. 在设计中找到了这个方法:

  def after_sign_out_path_for(resource_or_scope)
    root_path
  end

谁能告诉我如何进一步挖掘?即如何找到'resource_or_scope'?root_path 在路线中看起来不错。

这是我的路线.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
4

0 回答 0