Module: MultiTenantSubdomain::ActiveRecordExtension

Extended by:
ActiveSupport::Concern
Defined in:
lib/multi_tenant_subdomain/active_record_extension.rb

Overview

This module is used to extend ActiveRecord models to support multi-tenant subdomains.

It adds a default scope to the model to ensure that all records are scoped to the current tenant.

It also adds a before_validation callback to set the tenant_id on the model.