diff options
| author | Neeraj Singh <neerajdotname@gmail.com> | 2010-11-22 17:32:27 -0500 |
|---|---|---|
| committer | Neeraj Singh <neerajdotname@gmail.com> | 2010-11-22 17:32:27 -0500 |
| commit | 5debc65c356c619bce20dcc10c0befc7c4204ef5 (patch) | |
| tree | dc32bab1eccd11bacdaff70f25696689a2b9dc66 /actionpack/lib/action_dispatch/http/url.rb | |
| parent | 1c68e55ae5e90b7c072a1f6030ea3dd4becd8a07 (diff) | |
| parent | 818b366c3e3645b3375ee0b1d1023621dbeaede2 (diff) | |
| download | rails-5debc65c356c619bce20dcc10c0befc7c4204ef5.tar.gz rails-5debc65c356c619bce20dcc10c0befc7c4204ef5.tar.bz2 rails-5debc65c356c619bce20dcc10c0befc7c4204ef5.zip | |
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'actionpack/lib/action_dispatch/http/url.rb')
| -rw-r--r-- | actionpack/lib/action_dispatch/http/url.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index 4da82f958a..9c9eed2c6d 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -2,6 +2,7 @@ module ActionDispatch module Http module URL mattr_accessor :tld_length + self.tld_length = 1 # Returns the complete URL used for this request. def url @@ -67,7 +68,7 @@ module ActionDispatch # Returns the \domain part of a \host, such as "rubyonrails.org" in "www.rubyonrails.org". You can specify # a different <tt>tld_length</tt>, such as 2 to catch rubyonrails.co.uk in "www.rubyonrails.co.uk". - def domain(tld_length = 1) + def domain(tld_length = @@tld_length) return nil unless named_host?(host) host.split('.').last(1 + tld_length).join('.') |
