aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-06-11 15:30:12 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-06-11 15:30:12 -0700
commitba1c685d8cb12a1ac7079c1c629e0a8481c631d1 (patch)
treefdf2a30ab7ce6812e660cfb03fa4fa8dfde1f210 /actionpack
parent3327dd462ffa28a197ece51443e603f24c14ddc6 (diff)
downloadrails-ba1c685d8cb12a1ac7079c1c629e0a8481c631d1.tar.gz
rails-ba1c685d8cb12a1ac7079c1c629e0a8481c631d1.tar.bz2
rails-ba1c685d8cb12a1ac7079c1c629e0a8481c631d1.zip
only look up the subdomain once
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/http/url.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb
index b63c99d46f..6c2489ebb4 100644
--- a/actionpack/lib/action_dispatch/http/url.rb
+++ b/actionpack/lib/action_dispatch/http/url.rb
@@ -122,12 +122,13 @@ module ActionDispatch
tld_length = options[:tld_length] || @@tld_length
host = ""
- if options[:subdomain] == true || !options.key?(:subdomain)
+ subdomain = options[:subdomain]
+ if subdomain == true || !options.key?(:subdomain)
return _host if options[:domain].nil?
host << extract_subdomain(_host, tld_length).to_param
- elsif options[:subdomain].present?
- host << options[:subdomain].to_param
+ elsif subdomain
+ host << subdomain.to_param
end
host << "." unless host.empty?
host << (options[:domain] || extract_domain(_host, tld_length))