v2.1.0 - Show latest stable - 2 notes - Superclass: Object

CgiRequest and TestRequest provide concrete implementations.


TRUSTED_PROXIES = /^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\./i

MULTIPART_BOUNDARY = %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|n

EOL = "\015\012"


[R] env

The hash of environment variables for this request, such as { ‘RAILS_ENV’ => ‘production’ }.

Show files where this class is defined (1 file)
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('.')