From 977a2f38c75368d6f086517b03f48f7bde19bf79 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 12 Jun 2014 10:10:31 -0700 Subject: [PATCH] lookup subdomain from the options hash once, defaulting to true if the subdomain wasn't specified, it's the same as if specifying :subdomain as `true`, so we can default the value to `true` safely. --- actionpack/lib/action_dispatch/http/url.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index 0aa7e3433e..87e76113d6 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) -- GitLab