class

ActionController::AbstractRequest

v1.2.6 - Show latest stable - Superclass: Object

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

Attributes

[R]env

Files

  • actionpack/lib/action_controller/deprecated_request_methods.rb
  • actionpack/lib/action_controller/request.rb

2Notes

Different Method for Subdomains

cracell · Jul 30, 20086 thanks

@james

You can also access the subdomain via the subdomains array.

request.subdomains.first

subdomains from request

james · Jul 23, 20082 thanks

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('.')