- You can see screencasts @ Railscasts episode #221 Subdomains in Rails 3
- Actually, I never use multiples databases, but I have try use multiples schemas with postgresql, see @ Railscasts episode #389 Multitenancy with PostgreSQL pro
- You can use gem apartment for switching schema based on subdomain
I can't explain one by one because it would be too long to be explained. Hope this help