From 6183e1a460ccab6df1d07c3e99e98b61b2cc450b Mon Sep 17 00:00:00 2001 From: Derek Watson Date: Thu, 11 Apr 2013 22:12:19 -0400 Subject: Passing subdomain: '' to url_for removes the subdomain (instead of adding a leading .) Adding a boolean route constraint checks for presence/absence of request property --- actionpack/lib/action_dispatch/http/url.rb | 2 +- actionpack/lib/action_dispatch/journey/route.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index ab5399c8ea..e9d4cd6c34 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -100,7 +100,7 @@ module ActionDispatch tld_length = options[:tld_length] || @@tld_length host = "" - unless options[:subdomain] == false + unless options[:subdomain] == false || options[:subdomain] == '' host << (options[:subdomain] || extract_subdomain(options[:host], tld_length)).to_param host << "." end diff --git a/actionpack/lib/action_dispatch/journey/route.rb b/actionpack/lib/action_dispatch/journey/route.rb index 6fda085681..50e1853094 100644 --- a/actionpack/lib/action_dispatch/journey/route.rb +++ b/actionpack/lib/action_dispatch/journey/route.rb @@ -102,6 +102,10 @@ module ActionDispatch value === request.send(method).to_s when Array value.include?(request.send(method)) + when TrueClass + request.send(method).present? + when FalseClass + request.send(method).blank? else value === request.send(method) end -- cgit v1.2.3