Class: Veri::Inputs::Tenant

Inherits:
Base
  • Object
show all
Defined in:
lib/veri/inputs/tenant.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #process

Constructor Details

This class inherits a constructor from Veri::Inputs::Base

Instance Method Details

#resolveObject



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/veri/inputs/tenant.rb', line 4

def resolve
  case tenant = process
  when nil
    { tenant_type: nil, tenant_id: nil }
  when String
    { tenant_type: tenant, tenant_id: nil }
  when ActiveRecord::Base
    raise_error unless tenant.persisted?
    { tenant_type: tenant.class.to_s, tenant_id: tenant.public_send(tenant.class.primary_key) }
  else
    tenant
  end
end