diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-06-12 10:10:31 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-06-12 10:10:31 -0700 |
commit | 977a2f38c75368d6f086517b03f48f7bde19bf79 (patch) | |
tree | 4640494741aa2b6d1280bb353e2ddc7dd21f6687 | |
parent | 160f56c21ba3f8740e6d71ba9ad7d458b85077b4 (diff) | |
download | rails-977a2f38c75368d6f086517b03f48f7bde19bf79.tar.gz rails-977a2f38c75368d6f086517b03f48f7bde19bf79.tar.bz2 rails-977a2f38c75368d6f086517b03f48f7bde19bf79.zip |
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.
-rw-r--r-- | actionpack/lib/action_dispatch/http/url.rb | 4 |
1 files 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 @@ module ActionDispatch 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) |