diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index d823fd710e..ebced9cabe 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -570,22 +570,14 @@ module ActionDispatch end def subdomain_and_domain(options) + return nil unless options[:subdomain] || options[:domain] tld_length = options[:tld_length] || ActionDispatch::Http::URL.tld_length - current_domain = ActionDispatch::Http::URL.extract_domain(options[:host], tld_length) - current_subdomain = ActionDispatch::Http::URL.extract_subdomain(options[:host], tld_length) - - domain_parts = if options[:subdomain] && options[:domain] - [options[:subdomain], options[:domain]] - elsif options[:subdomain] - [options[:subdomain], current_domain] - elsif options[:domain] - [current_subdomain, options[:domain]] - else - nil - end - - domain_parts ? domain_parts.join('.') : nil + host = "" + host << (options[:subdomain] || ActionDispatch::Http::URL.extract_subdomain(options[:host], tld_length)) + host << "." + host << (options[:domain] || ActionDispatch::Http::URL.extract_domain(options[:host], tld_length)) + host end def handle_positional_args(options) |