aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-06-12 10:05:26 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-06-12 10:05:26 -0700
commit160f56c21ba3f8740e6d71ba9ad7d458b85077b4 (patch)
treeab67bc3d74d2752122f9c5316c6ad950de3a819b /actionpack
parent21c626133adc4b5060df1081d9423024b6b7479d (diff)
downloadrails-160f56c21ba3f8740e6d71ba9ad7d458b85077b4.tar.gz
rails-160f56c21ba3f8740e6d71ba9ad7d458b85077b4.tar.bz2
rails-160f56c21ba3f8740e6d71ba9ad7d458b85077b4.zip
only extract domain from the options hash 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 fd310d5219..0aa7e3433e 100644
--- a/actionpack/lib/action_dispatch/http/url.rb
+++ b/actionpack/lib/action_dispatch/http/url.rb
@@ -124,18 +124,19 @@ module ActionDispatch
return _host unless named_host?(_host)
tld_length = options[:tld_length] || @@tld_length
+ subdomain = options[:subdomain]
+ domain = options[:domain]
host = ""
- subdomain = options[:subdomain]
if subdomain == true || !options.key?(:subdomain)
- return _host if options[:domain].nil?
+ return _host if domain.nil?
host << extract_subdomain(_host, tld_length)
elsif subdomain
host << subdomain.to_param
end
host << "." unless host.empty?
- host << (options[:domain] || extract_domain_from(_host, tld_length))
+ host << (domain || extract_domain_from(_host, tld_length))
host
end