Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Extended by:
MultiTenant::CopyFromClient
Defined in:
lib/activerecord-multi-tenant/default_scope.rb

Class Method Summary collapse

Methods included from MultiTenant::CopyFromClient

copy_from_client

Class Method Details

.unscopedObject



4
5
6
7
8
9
10
# File 'lib/activerecord-multi-tenant/default_scope.rb', line 4

def unscoped
  if respond_to?(:scoped_by_tenant?) && MultiTenant.current_tenant_id
    unscoped_orig.where(arel_table[MultiTenant.partition_key].eq(MultiTenant.current_tenant_id))
  else
    unscoped_orig
  end
end

.unscoped_origObject



3
# File 'lib/activerecord-multi-tenant/default_scope.rb', line 3

alias :unscoped_orig :unscoped