mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
only look up the subdomain once
This commit is contained in:
parent
3327dd462f
commit
ba1c685d8c
1 changed files with 4 additions and 3 deletions
|
@ -122,12 +122,13 @@ module ActionDispatch
|
||||||
tld_length = options[:tld_length] || @@tld_length
|
tld_length = options[:tld_length] || @@tld_length
|
||||||
|
|
||||||
host = ""
|
host = ""
|
||||||
if options[:subdomain] == true || !options.key?(:subdomain)
|
subdomain = options[:subdomain]
|
||||||
|
if subdomain == true || !options.key?(:subdomain)
|
||||||
return _host if options[:domain].nil?
|
return _host if options[:domain].nil?
|
||||||
|
|
||||||
host << extract_subdomain(_host, tld_length).to_param
|
host << extract_subdomain(_host, tld_length).to_param
|
||||||
elsif options[:subdomain].present?
|
elsif subdomain
|
||||||
host << options[:subdomain].to_param
|
host << subdomain.to_param
|
||||||
end
|
end
|
||||||
host << "." unless host.empty?
|
host << "." unless host.empty?
|
||||||
host << (options[:domain] || extract_domain(_host, tld_length))
|
host << (options[:domain] || extract_domain(_host, tld_length))
|
||||||
|
|
Loading…
Reference in a new issue