public
Fork of veilleperso/request_routing
Description: Fork of request_routing to support long tld domains like mydomain.com.au
Homepage: http://svn.danwebb.net/external/rails/plugins/request_routing/trunk/
Clone URL: git://github.com/dam5s/request_routing.git
Damien Le Berrigaud (author)
Mon Oct 05 21:19:25 -0700 2009
name age message
file LICENSE Loading commit data...
file README
file Rakefile
file init.rb Thu Aug 17 10:07:28 -0700 2006 initial move from vivabit repos. git-svn-id:... [danwebb]
directory lib/
directory tasks/ Thu Aug 17 10:07:28 -0700 2006 initial move from vivabit repos. git-svn-id:... [danwebb]
directory test/ Mon Oct 05 21:03:46 -0700 2009 Added support for domain with long TLDs like .c... [Damien Le Berrigaud]
README
Request Routing Plugin for Ruby on Rails
========================================
(c) Dan Webb 2006 (dan@vivabit.com)

Plugin that allows you to define routing conditions that test 
methods/properties of the request object such as subdomain, domain,
port.  You can test them either against a value or with a Regexp
(assuming the method returns a string)

*UPDATE* Now works with the new routing code as implemented in edge rails.  Note the
change in API: use :conditions instead of :requirements.

*UPDATE* Now you can use for domain names with 2 tld!

== Installation

    script/plugin install git://github.com/dam5s/request_routing.git

== Usage

In routes.rb you can specify use the :requirements hash with request properties:

    map.connect '', :controller => 'main', :conditions => { :subdomain => 'www' }

    map.connect 'admin', :controller => 'admin', :conditions => { :remote_ip => /^127\.0\.0\.[0-9]$/ }

You can also, of course, use the conditions hash in map.with_options calls.

The allowed properties are:

    :subdomain  (only checks the first subdomain)
    :domain (only accurate for single tld domain names)
    :domain_2 (use for 2 tld domain names)
    :method (a symbol)
    :port (a number)
    :remote_ip 
    :content_type (content type of the post body)
    :accepts 
    :request_uri (the entire request uri)
    :protocol (either http:// or https://)