Gmane
From: Jeremy Huffman <jeremy@...>
Subject: Creating Routing Rules based on Subdomain
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2005-04-03 23:26:14 GMT (3 years, 19 weeks, 5 days, 15 hours and 20 minutes ago)
I thought this would be really simple but the docs do not seem to cover 
it. I need to create routing rules based on my subdomain.

I have wap.mydomain.com. When users access this URL, they should get 
redirected to a different controller. I have subclassed some of my 
controllers, so for instance I have WapListItemsController < 
ListItemsController.

This way I can have separate views/layouts and, if necessary, separate 
controller logic (though so far, the controller logic is just inherited 
from the parent).

Right now I have a default rule like:

  map.connect '', :controller => 'list_items', :action => 'show'

I want something that would work like:

  map.connect subdomain('wap'), :controller => 'wap_list_items', :action 
=> 'show'

Any ideas?