Module: TenantCheck::ActiveRecord::TenantSafetyCheck

Included in:
CollectionProxyCheck, RelationCheck
Defined in:
lib/tenant_check/active_record/extensions.rb

Class Method Summary collapse

Class Method Details

.internal_force_safe(safe) ⇒ Object



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

def internal_force_safe(safe)
  # rubocop:disable Style/ParallelAssignment
  prev, self.internal_force_safe_scope = internal_force_safe_scope?, true if safe
  # rubocop:enable Style/ParallelAssignment
  yield
ensure
  self.internal_force_safe_scope = prev if safe
end

.internal_force_safe_scope=(value) ⇒ Object



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

def internal_force_safe_scope=(value)
  Thread.current[:tenant_check_internal_force_safe_scope] = value
end

.internal_force_safe_scope?Boolean

Returns:

  • (Boolean)


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

def internal_force_safe_scope?
  Thread.current[:tenant_check_internal_force_safe_scope]
end