Module: TenantCheck::ActiveRecord::RelationCheck

Includes:
TenantSafetyCheck
Defined in:
lib/tenant_check/active_record/extensions.rb

Instance Method Summary collapse

Methods included from TenantSafetyCheck

internal_force_safe, internal_force_safe_scope=, internal_force_safe_scope?

Instance Method Details

#calculate(operation, column_name) ⇒ Object



105
106
107
108
109
110
111
112
113
# File 'lib/tenant_check/active_record/extensions.rb', line 105

def calculate(operation, column_name)
  return super unless ::TenantCheck.enable_and_started?
  TenantSafetyCheck.internal_force_safe(_tenant_safe_mark?) do
    # FIXME: Calling has_include? is highly implementation dependent. It subject to change by rails versions.
    return super if has_include?(column_name)
    check_tenant_safety(operation.to_s)
    super
  end
end

#pluck(*column_names) ⇒ Object



115
116
117
118
119
120
121
122
123
# File 'lib/tenant_check/active_record/extensions.rb', line 115

def pluck(*column_names)
  return super unless ::TenantCheck.enable_and_started?
  TenantSafetyCheck.internal_force_safe(_tenant_safe_mark?) do
    # FIXME: Calling has_include? is highly implementation dependent. It subject to change by rails versions.
    return super if has_include?(column_names.first)
    check_tenant_safety('pluck')
    super
  end
end