Reputation: 241
It seems like most of the documentation / tutorials that I’ve found about multi-tenanted apps seem to prefer scoping via a subdomain. The old classic-style basecamp probably set the presendent for this, where each user / company would have a http://mycompany.app.com address. Apps like Harvest, for example, also do this.
I recently noticed that the new basecamp no longer has company subdomains...
Just wondering what the advantages of scoping through a subdomain are vs. say, scoping the User’s data through a gem like Pundit or CanCan?
Upvotes: 3
Views: 1292
Reputation: 51
Using Pundit or CanCan (CanCanCan) is more for roles/authorization of what a user(non-admin) can do in the application.
Mutlitenancy using subdomains without separate schemas just gives a unique account_id in your tables where as if you use postgres schemas it creates a separate schema for each subdomain(account); so each subdomain/account has their own copy of the tables..
You can also have multitenancy not using subdomains by using a gem such as https://github.com/dsaronin/milia
There are pros and cons for each. Also checkout this video: http://confreaks.com/videos/111-aac2009-writing-multi-tenant-applications-in-rails
Upvotes: 5