Ask A Question

Notifications

You’re not receiving notifications from this thread.

I want to understand how basecamp separates account?

Dmitrii Amelchenko asked in Rails

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.

Reply

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

Reply

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.

Reply

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.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 85,376+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.