From de942e5534a26942e261a7699adc28597c5ad1bc Mon Sep 17 00:00:00 2001 From: Kamil Sobieraj Date: Tue, 4 Oct 2011 09:16:34 +0100 Subject: :subdomain can now be specified with a value of false in url_for, allowing for subdomain(s) removal from the host during link generation. Closes #2025 --- actionpack/lib/action_dispatch/http/url.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_dispatch/http') diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index caa1decb9e..0db404957b 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -64,13 +64,15 @@ module ActionDispatch end def host_or_subdomain_and_domain(options) - return options[:host] unless options[:subdomain] || options[:domain] + return options[:host] unless options[:subdomain] || options[:subdomain] == false || options[:domain] tld_length = options[:tld_length] || @@tld_length host = "" - host << (options[:subdomain] || extract_subdomain(options[:host], tld_length)) - host << "." + unless options[:subdomain] == false + host << (options[:subdomain] || extract_subdomain(options[:host], tld_length)) + host << "." + end host << (options[:domain] || extract_domain(options[:host], tld_length)) host end -- cgit v1.2.3