The following should work as per http://edgeguides.rubyonrails.org/routing.html#using-root
routes.rb
Rails.application.routes.draw do
scope module: 'admin' do
constraints subdomain: 'admin' do
root to: 'tenants#index'
resources :tenants
end
end
root to: 'users#index'
resources :users
end
Unfortunately, whichever root is listed first ends up taking over. As listed, admin.xyz.com will fire tenants#index. If the outer root to: 'users#index' is moved first in the source order then it becomes the root path for all including admin.xyz.com.
Do I read guide correctly? I so, this may be a bug in rails 5.0.0-beta1.
I think the problem is you have to put an :as => something_not_root on one or the other that you use in order to use both at the same time. I referenced this SO post for that information
So try this instead
Rails.application.routes.draw do
scope module: 'admin' do
constraints subdomain: 'admin' do
root to: 'tenants#index', as: tenants_root
resources :tenants
end
end
root to: 'users#index'
resources :users
end
and then call it
tenants_root_path