diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index 0aa7e3433ece5b1b13c9b84f9e41528ea91c1e1b..87e76113d6182b4a4f6756f02318944fb69d4700 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -124,11 +124,11 @@ def normalize_host(_host, options) return _host unless named_host?(_host) tld_length = options[:tld_length] || @@tld_length - subdomain = options[:subdomain] + subdomain = options.fetch :subdomain, true domain = options[:domain] host = "" - if subdomain == true || !options.key?(:subdomain) + if subdomain == true return _host if domain.nil? host << extract_subdomain(_host, tld_length)