我的routes.rb中有两个设计模型:
devise_for :practitioners, controllers: { sessions: "practitioners/sessions" }
devise_for :dashboard_accounts
我希望doctor.mydomain.com/
映射到我的从业者的登录页面。
我尝试了以下(三个评论块):
constraints(:subdomain => 'doctor') do
# FIRST BLOCK
# devise_scope :practitioners do
# root :to => 'practitioners/sessions#new'
# end
# SECOND BLOCK
# scope module: 'practitioners' do
# get '/' => 'practitioners/sessions#new'
# end
# THIRD BLOCK
# devise_scope :practitioners do
# get "/", to: "devise/sessions#new"
# end
end
但是没有用。我该怎么办?
答案 0 :(得分:1)
routes.rb:
devise_for :practitioners, controllers: { sessions: "practitioners/sessions" }
constraints(subdomain: /doctor*/) do
devise_scope :practitioner do
authenticated :practitioner do
root :to => 'practitioners/practitioner#index', as: :practitioner_root
end
unauthenticated :practitioner do
root :to => 'practitioners/sessions#new', as: :unauthenticated_root
end
end
end