v1.2.0 - Show latest stable - 2 notes - Superclass: Object

Subclassing AbstractRequest makes these methods available to the request objects used in production and testing, CgiRequest and TestRequest

Show files where this class is defined (2 files)
Register or log in to add new notes.
July 30, 2008
6 thanks

Different Method for Subdomains


You can also access the subdomain via the subdomains array.

July 23, 2008 - (v1.0.0 - v2.1.0)
2 thanks

subdomains from request

Useful for discovering what domain/subdomain(s) the current request came from (Rails application may operate differently depending on which subdomain is passed in, this is a great way to segment functionality using the route).


Doesn’t get much simpler than that :).

Likewise if you want to see only the subdomain component(s). Given a domain, example.com

request.host.gsub('example.com', '').split('.')