Module: PgRls::MultiTenancy

Defined in:
lib/pg_rls/multi_tenancy.rb

Overview

Ensure Connection is with App_use

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/pg_rls/multi_tenancy.rb', line 6

def self.included(base)
  base.class_eval do
    around_action :switch_tenant!

    def current_tenant
      @current_tenant ||= request.subdomain
    end
    helper_method :current_tenant
  end
end