Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

only extract domain from the options hash once

  • Loading branch information...
commit 160f56c21ba3f8740e6d71ba9ad7d458b85077b4 1 parent 21c6261
@tenderlove tenderlove authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 actionpack/lib/action_dispatch/http/url.rb
View
7 actionpack/lib/action_dispatch/http/url.rb
@@ -124,18 +124,19 @@ def normalize_host(_host, options)
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
Please sign in to comment.
Something went wrong with that request. Please try again.