aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-01-12 14:36:05 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-01-12 14:42:15 -0200
commit47d8fc0840d73ee0a634b3b40157bf78a90a20f2 (patch)
tree84bf6850849d9e328b6c0dddf77000e0c22cd3d3
parent6e23c235184ecc72f4e68508fda91bba0652b6e2 (diff)
downloadrails-47d8fc0840d73ee0a634b3b40157bf78a90a20f2.tar.gz
rails-47d8fc0840d73ee0a634b3b40157bf78a90a20f2.tar.bz2
rails-47d8fc0840d73ee0a634b3b40157bf78a90a20f2.zip
Simplify named host logic and missing host condition check
-rw-r--r--actionpack/lib/action_dispatch/http/url.rb4
1 files changed, 2 insertions, 2 deletions
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)