Module: TenantCheck::ActiveRecord::TenantSafetyCheck

Included in:
CollectionProxyExtension, RelationExtension
Defined in:
lib/tenant_check/active_record/extensions.rb

Class Method Summary collapse

Class Method Details

.safe_preload(safe) ⇒ Object



25
26
27
28
29
30
# File 'lib/tenant_check/active_record/extensions.rb', line 25

def safe_preload(safe)
  prev, self.safe_preloading = safe_preloading, true if safe # rubocop:disable Style/ParallelAssignment
  yield
ensure
  self.safe_preloading = prev if safe
end

.safe_preloadingObject



17
18
19
# File 'lib/tenant_check/active_record/extensions.rb', line 17

def safe_preloading
  Thread.current[:tenant_check_safe_preloading]
end

.safe_preloading=(value) ⇒ Object



21
22
23
# File 'lib/tenant_check/active_record/extensions.rb', line 21

def safe_preloading=(value)
  Thread.current[:tenant_check_safe_preloading] = value
end