Basic subdomains example app.  See http://richonrails.com/articles/basic-subdomains-in-ruby-on-rails for details.