Skip to content
Browse files

Request#subdomain returns a string version of Request#subdomains

  • Loading branch information...
1 parent 7317d9e commit fef7a77386b0e738f3b5c25fd9ab0350a6e56d6c @josh josh committed Feb 28, 2010
Showing with 4 additions and 0 deletions.
  1. +4 −0 actionpack/lib/action_dispatch/http/url.rb
View
4 actionpack/lib/action_dispatch/http/url.rb
@@ -81,6 +81,10 @@ def subdomains(tld_length = 1)
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] || '')

1 comment on commit fef7a77

@russbuelt

Joshua, thanks!

Please sign in to comment.
Something went wrong with that request. Please try again.