I'm building multi-tenant application.
All data isolation is done by TenantID column in each table.
What is the best way to automatically handle multi-tenancy for all tenant models.
Example:
Contacts.new({.....}) should automatically add :tenant => curret_user.tenant
Contacts.where({....}) should also add :tenant => curret_user.tenant
Currently I see something like this in CanCan gem which that can fetch records for specific user parameters. But it is not providing anything for insert and update operation. Or may be I doesn't understand how to do it.
Regards, Alexey Zakharov.