我的应用程序具有三种设计模型:用户、雇主和审计员。我可以创建所有三个并使用用户和雇主登录,但 Devise 不会为审核员创建新会话。
Started POST "/auditors/sign_in" for 127.0.0.1 at 2012-10-05 01:41:44 +0200
Processing by Devise::SessionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"vg1hGiEx3Ly1YRVX1XaWyEkz85lJU/5Ap/TcVo8+xWo=", "auditor"=>{"email"=>"auditor5@gmail.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"}
Completed 401 Unauthorized in 0ms
我使用设计生成器来创建模型:
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
..在其他型号中看起来相同。
路线似乎很好:
devise_for :auditors
devise_for :employers
resources :employers, :only => [:show, :edit, :index, :update, :credit]
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
devise_for :users
devise_for :users, :controllers => { :registrations => "registrations" }
我没有更改设计中的视图或会话控制器中的任何内容。欢迎任何想法。