Module: Handcart::UrlHelper

Defined in:
app/helpers/handcart/url_helper.rb

Instance Method Summary collapse

Instance Method Details

#url_for(options = nil) ⇒ Object



9
10
11
12
13
14
# File 'app/helpers/handcart/url_helper.rb', line 9

def url_for(options = nil)
  if options.kind_of?(Hash) && options.has_key?(:subdomain)
    options[:host] = with_subdomain(options.delete(:subdomain))
  end
  super
end

#with_subdomain(subdomain) ⇒ Object



3
4
5
6
7
# File 'app/helpers/handcart/url_helper.rb', line 3

def with_subdomain(subdomain)
  subdomain = (subdomain || "")
  subdomain += "." unless subdomain.empty?
  [subdomain, request.domain, request.port_string].join
end