Friday, May 18, 2007

sub-domains with rails




In my new Personal Trainer website that I'm designing, I really want to have subdomain URLs for each trainer, so for example, if our site was:

train-it-up.net

For a trainer named, for example "Deryn", she would have her own URL:

deryn.train-it-up.net

URLs like these will be really easy for trainers to put on their business cards, and besides, all the cool kids are doing it.

So, I'm learning how to do this in Ruby on Rails, and am using the following resources to help me:

url for domain at the Ruby on Rails wiki
The request_routing plugin.
virtual hosts in apache
Deploying multiple applications on the railsforum
Building A Multi-Site Application
The account_location plugin
Integrating the account_location plugin with acts_as_authenticated

For authentication, I've finally moved away from the ancient Login Generator with my custom remembralls that I adapted from lightbox, and am using the modern acts_as_authenticated plugin. Some more information is on the Rails wiki. I'm thinking of integrating it with OpenID but that's probably going too far.