I have a patch coming soon (when I get authorization from my employer) that will allow the use of the host name (domain, subdomain etc.) in routes. Here's the syntax I'm working with right now:

  map.connect '//:host/:controller/:action/:id'
map.connect '//:host/:action/:id', :host => /two\..+/, :controller => 'two' map.connect '//:host/:id', :host => /one\..+/, :controller => 'one', :action => 'list'

The last route, for example, would route to OneController#list when the URL "http://one.localhost:3000/123"; or "http://one.mydomain.com/ 123" is given.

I needed some way to distinguish between routes that care about the host and routes that don't. Thus, I've prepended a "//" in front to denote "I care about the host and my first symbol should be match against the host". In the example URLs above, the :host Regexp will be compared with "one.localhost" and "one.mydomain.com".

I think it would be natural for most developers to prepend a '//' since it closely follows the URI format of protocol://domain/path? query_string.

Thoughts?

Duane Johnson
(canadaduane)
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to