Url For Domain plugin

Plugin details

This plugin modifies the url_for behaviour in the following manner:
url_for behaviour is the same except when the :subdomain is set. If it's set to a string, the string will be used as a subdomain for the normal domain name. The :tld_length option defines the length of the normal domain. This defaults to 1.

Repositoryhttps://fngtps.com/svn/rails-plugins/trunk/url_for_domain/ Tags url, domain LicenseUnknown

Documentation

Install the plugin:
ruby script/plugin install https://fngtps.com/svn/rails-plugins/trunk/url_for_domain/

Examples (normal domain is example.com):

url_for(:subdomain => 'manfred') #=> ''
url_for(:subdomain => 'manfred', :only_path => false) #=> 'http://manfred.example.com/'
url_for(:subdomain => 'manfred', :only_path => false) #=> 'http://manfred.example.com/'
url_for(:subdomain => false, :only_path => false) #=> 'http://example.com/'


When the domain is 'example.co.uk'

url_for(:subdomain => 'manfred', :only_path => false) #= 'http://manfred.co.uk'
url_for(:subdomain => 'manfred', :tld_length => 2, :only_path => false)
   #= 'http://manfred.example.co.uk'

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, 9 months ago