Multi-tenancy is pretty common in web-projects – when you want to give records access only for users who created those records.
This article will show you how to implement it in the most simple way, in single database.
What We’re Creating HereImagine a web-project to manage Books, and every user may see only their own entered books.
But also every book has origin country field from Country model, and that model needs to be accessible to everyone, without multi-tenancy.
In general, the rule is simple: for those models that you want to be “multi-tenantable”, use the trait.