aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-06-11 13:55:46 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-06-11 14:09:54 -0700
commit1b14bff81a9ab6654badf52b552f90c8fc3ab0e3 (patch)
tree80b82f78be056f0f363ed3bbb1ad4fd9e9ef91e6 /actionpack
parent3654f1b7e48c05e95fa7ea8f87ddfcfee12de771 (diff)
downloadrails-1b14bff81a9ab6654badf52b552f90c8fc3ab0e3.tar.gz
rails-1b14bff81a9ab6654badf52b552f90c8fc3ab0e3.tar.bz2
rails-1b14bff81a9ab6654badf52b552f90c8fc3ab0e3.zip
rm `same_host?`. The same conditional is two lines down.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/http/url.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb
index 6112ab2fd6..97cd32a308 100644
--- a/actionpack/lib/action_dispatch/http/url.rb
+++ b/actionpack/lib/action_dispatch/http/url.rb
@@ -102,10 +102,6 @@ module ActionDispatch
host && IP_HOST_REGEXP !~ host
end
- def same_host?(options)
- (options[:subdomain] == true || !options.key?(:subdomain)) && options[:domain].nil?
- end
-
def normalize_protocol(protocol)
case protocol
when nil
@@ -120,12 +116,14 @@ module ActionDispatch
end
def normalize_host(_host, options)
- return _host if !named_host?(_host) || same_host?(options)
+ return _host if !named_host?(_host)
tld_length = options[:tld_length] || @@tld_length
host = ""
if options[: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