Skip to content

Commit

Permalink
Simplify named host logic and missing host condition check
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosantoniodasilva committed Jan 12, 2012
1 parent 6e23c23 commit 47d8fc0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions actionpack/lib/action_dispatch/http/url.rb
Expand Up @@ -23,7 +23,7 @@ def extract_subdomain(host, tld_length = @@tld_length)
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

Expand Down Expand Up @@ -54,7 +54,7 @@ def url_for(options = {})
private

def named_host?(host)
!(host.nil? || IP_HOST_REGEXP.match(host))
host && IP_HOST_REGEXP !~ host
end

def rewrite_authentication(options)
Expand Down

0 comments on commit 47d8fc0

Please sign in to comment.