Class: ActsAsTenant::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_as_tenant/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pkeyObject



9
10
11
# File 'lib/acts_as_tenant/configuration.rb', line 9

def pkey
  @pkey ||= :id
end

#require_tenantObject



5
6
7
# File 'lib/acts_as_tenant/configuration.rb', line 5

def require_tenant
  @require_tenant ||= false
end

Instance Method Details

#job_scopeObject



13
14
15
# File 'lib/acts_as_tenant/configuration.rb', line 13

def job_scope
  @job_scope || ->(relation) { relation.all }
end

#job_scope=(scope) ⇒ Object

Used for looking job tenants in background jobs

Format matches Rails scopes

job_scope = ->(relation) {}
job_scope = -> {}


23
24
25
26
27
28
29
# File 'lib/acts_as_tenant/configuration.rb', line 23

def job_scope=(scope)
  @job_scope = if scope && scope.arity == 0
    proc { instance_exec(&scope) }
  else
    scope
  end
end