instance method
domain
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.2.3Signature
domain(tld_length = 1)
Returns the \domain part of a \host, such as “rubyonrails.org” in “www.rubyonrails.org”. You can specify a different tld_length, such as 2 to catch rubyonrails.co.uk in “www.rubyonrails.co.uk”.
Parameters
-
tld_lengthopt = 1
Source
# File actionpack/lib/action_controller/request.rb, line 326
def domain(tld_length = 1)
return nil unless named_host?(host)
host.split('.').last(1 + tld_length).join('.')
end
Defined in actionpack/lib/action_controller/request.rb line 326
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionController::AbstractRequest