Plugins - Request Routing

StarAdd to favorites

Plugin that allows you to define routing requirements 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).

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

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

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

The allowed properties are:

    :subdomain  (only checks the first subdomain)
    :domain 
    :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://)

Dan Webb

http://svn.danwebb.net/external/rails/plugins/request_routing/trunk/

Rails' (MIT)

  • Currently 4.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Misc. Enhancements

Tags

Comments

Add a comment
Elliot 10 May 2008

The url doesn't work anymore?

Eric Campbell 11 Aug 2007

This works great, except I had to use

:conditions => {:subdomain => 'www'}

instead of

:requirements => {:subdomain => 'www'}

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?