I'm trying to get rails to go to another controller action # according to subdomain, and this is what I still have in routes.rb
Petworkslabs::Application.routes.draw do
get '/', to: 'custom#show', constraints: {subdomain: '/.+/'}, as: 'custom_root'
get '/', to: "welcome#home", as: 'default_root'
end
rake shows the correct routes I want to do
rake routes
Prefix Verb URI Pattern Controller
custom_root GET / custom
default_root GET / welcome
But for some reason I can’t get requests like abc.localhost: 3000 to get into the user controller. He always directs him to greet # at home. Any ideas? I am new to rails, so any general debugging tips would also be appreciated.
EDIT: I went through the code using a debugger, and this is what I found
(rdb: 32) request.domain "Abc.localhost" (rdb: 32) request.subdomain "" (rdb: 32) request.subdomain.present? Lying
, - , , . , , .