
Easy multi-tenancy for Rails in a shared database setup.
Acts As Tenant is a robust gem designed specifically for Ruby on Rails applications that require a multi-tenancy feature. With its creation rooted in addressing the need for a seamless and fail-safe approach to implementing multi-tenancy through a shared database strategy, this gem integrates smoothly with Rails. Acts As Tenant ensures that models are scoped appropriately to a tenant, allowing developers to prioritize security and data isolation within their apps.
In a landscape where multi-tenancy can be a challenging setup, Acts As Tenant streamlines the process, providing flexibility in how current tenants are identified and ensuring all tenant models are correctly scoped throughout the application's lifecycle.
Row-Level Multitenancy: Utilizes a tenant ID column in each model for easy record filtering, offering an efficient mechanism for multi-tenancy without the complexities of schema-based approaches.
Flexible Tenant Identification: Allows tenants to be set through subdomains, controller settings, or block configurations, providing versatility based on the application’s needs.
Tenant Model Integration: Explicitly associates tenants with an Account model, using subdomains for tenant identification, which helps maintain order and clarity within database interactions.
Security Measures: Protects against potential vulnerabilities by ensuring that tenant scoping is robust and prevents unauthorized access to tenant-specific data.
Uniqueness Validation: Includes a method, validates_uniqueness_to_tenant, which ensures data integrity by validating that records remain unique within their respective tenants.
Helper Method for Current Tenant: Simplifies tenant management by providing a helper method that contains the current tenant’s information, facilitating easier access throughout the application.
Comprehensive Installation Guide: Features a straightforward setup process, making it easy for developers to integrate Acts As Tenant into existing Rails applications without significant overhead.
