module ActionDispatch::Http::URL

def extract_subdomains_from(host, tld_length)

def extract_subdomains_from(host, tld_length)
  parts = host.split(".")
  parts[0..-(tld_length + 2)]
end