From 47d8fc0840d73ee0a634b3b40157bf78a90a20f2 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Thu, 12 Jan 2012 14:36:05 -0200 Subject: Simplify named host logic and missing host condition check --- actionpack/lib/action_dispatch/http/url.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 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 2367231359..c5adfcd83a 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -23,7 +23,7 @@ module ActionDispatch end def url_for(options = {}) - unless options[:host].present? || options[:only_path].present? + if options[:host].blank? && options[:only_path].blank? raise ArgumentError, 'Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true' end @@ -54,7 +54,7 @@ module ActionDispatch private def named_host?(host) - !(host.nil? || IP_HOST_REGEXP.match(host)) + host && IP_HOST_REGEXP !~ host end def rewrite_authentication(options) -- cgit v1.2.3