Browse files

rm `same_host?`. The same conditional is two lines down.

  • Loading branch information...
1 parent 3654f1b commit 1b14bff81a9ab6654badf52b552f90c8fc3ab0e3 @tenderlove tenderlove committed Jun 11, 2014
Showing with 3 additions and 5 deletions.
  1. +3 −5 actionpack/lib/action_dispatch/http/url.rb
View
8 actionpack/lib/action_dispatch/http/url.rb
@@ -102,10 +102,6 @@ def named_host?(host)
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 @@ def normalize_protocol(protocol)
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

0 comments on commit 1b14bff

Please sign in to comment.