Skip to main content

I want to understand how basecamp separates account?

Rails • Asked by Dmitry Amelchenko

Is part 3319000 of url 3.basecamp.com/3319000/projects just a show action in the controller or is there implemented by gems? Will be great to see some examples. Sorry for my english.


Check Gorails courses on multitenancy or this book: https://leanpub.com/multi-tenancy-rails-2


Yeah, like Szilard said that's basically be their way of doing the multi-tenancy. They just namespace the routes with an /:account_id or something at the beginning and have all their resources inside of that so that your account id is included in every single request. Effectively the exact same thing as doing a subdomain for multitenancy but they're already using the subdomains for the various versions of Basecamp.


Along with what the others already mentioned, I've also found it easier to work with nested routes instead of subdomains. Subdomains used to (not sure if they still do) require additional work for SSL certs to work properly, or you had to purchase a more expensive cert on some hosting services for subdomains.

Also, using subdomains in development requires a few additional steps.

Some of my info may be out-of-date since I haven't played with subdomains in a year or two, but I found nested routes to be much cleaner and tended to play "nice" with Rails and its conventions.

This is also how Github does their namespacing, where it is github.com/{USER_NAME}/{REPO_NAME}

The alternate would be {USER_NAME}.github.com/{REPO_NAME} and that just gets clunky and isn't as easy to type out in a URL, in my opinion.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.