1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Request#subdomain returns a string version of Request#subdomains

This commit is contained in:
Joshua Peek 2010-02-28 17:16:34 -06:00
parent 7317d9ef4c
commit fef7a77386

View file

@ -81,6 +81,10 @@ module ActionDispatch
parts[0..-(tld_length+2)]
end
def subdomain(tld_length = 1)
subdomains(tld_length).join('.')
end
# Returns the query string, accounting for server idiosyncrasies.
def query_string
@env['QUERY_STRING'].present? ? @env['QUERY_STRING'] : (@env['REQUEST_URI'].to_s.split('?', 2)[1] || '')