To do basecamp style subdomains in merb, install the slice merb-auth-slice-multisite.
It will setup the site model and authenticate the users based on the subdomain.
It also allows you to use it against regular domains routed to your application (similar to how wordpress.com routes a domain to yourusername.wordpress.com blog).
The README has clear instructions on installation. There is a video tutorial as well.
A few days ago, I did a post about a custom strategy to authenticate a user in a merb application based on whether they belonged to the subdomain or not (link). I decided to make it more modular by turning it into a slice. Best of all, it works with ck’s excellent merb-auth-slice-activation and hassox’s: merb-auth-slice-password.
It could definitely use some improvement yet. I’m still a young learner of Ruby. Email me or, better yet, fork the project.
Aside: I’ve been meaning to take a closer look at robby on rails post about subdomain accounts with Ruby on Rails explained. I’m guessing it will enlighten me on ways I can improve on this slice.
FYI: The implementation in your controllers is the same as you see on David’s post about How to do basecamp style subdomains in rails.
Thanks goes to Christian Kebekus (ck) and Daniel Neighman (hassox). Their slices were very helpful.
Spitfire Sky | github | archives | resume