Permalink
Browse files

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.
  • Loading branch information...
1 parent 160f56c commit 977a2f38c75368d6f086517b03f48f7bde19bf79 @tenderlove tenderlove committed Jun 12, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 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)

0 comments on commit 977a2f3

Please sign in to comment.