Module: SubdomainRoutes::UrlRewriter
Class Method Summary
collapse
Instance Method Summary
collapse
#rewrite_subdomain_options, #subdomain_procs
Class Method Details
.included(base) ⇒ Object
69
70
71
72
|
# File 'lib/subdomain_routes/url_writer.rb', line 69
def self.included(base)
base.alias_method_chain :rewrite, :subdomains
base::RESERVED_OPTIONS << :subdomain end
|
Instance Method Details
#rewrite_with_subdomains(options) ⇒ Object
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/subdomain_routes/url_writer.rb', line 74
def rewrite_with_subdomains(options)
host = options[:host] || @request.host
protocol = options[:protocol] || (@request.ssl? ? @request.protocol : nil)
port = options[:port] || (@request.port_string =~ /:(\d+)$/ ? $1.to_i : nil)
if options[:subdomains] && host.blank?
raise HostNotSupplied, "Missing host to link to!"
end
rewrite_subdomain_options(options, host, port, protocol)
rewrite_without_subdomains(options)
end
|