使用子域设计映射到“/”
Devise mapping to "/" with subdomain
我的 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
但是没有任何效果。我应该怎么做?
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
我的 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
但是没有任何效果。我应该怎么做?
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