class
v1.1.6 -
Show latest stable
-
2 notes
- Superclass:
Object
- 1.0.0 (0)
- 1.1.6 (30)
- 1.2.6 (0)
- 2.0.3 (-38)
- 2.1.0 (0)
- 2.2.1 (0)
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2
- 7.1.3.4
- What's this?
Subclassing AbstractRequest makes these methods available to the request objects used in production and testing, CgiRequest and TestRequest
Register or
log in
to add new notes.
cracell -
July 30, 2008
6 thanks
Different Method for Subdomains
@james
You can also access the subdomain via the subdomains array.
request.subdomains.first
james -
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).
request.host.split('.')
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('.')