Module: Effective::Resources::Tenants

Included in:
Effective::Resource
Defined in:
app/models/effective/resources/tenants.rb

Instance Method Summary collapse

Instance Method Details

#tenantObject



11
12
13
14
15
16
17
18
# File 'app/models/effective/resources/tenants.rb', line 11

def tenant
  return unless tenant?
  return nil unless klass.present?
  return nil unless class_name.include?('::')

  name = class_name.split('::').first.downcase.to_sym
  name if Rails.application.config.tenants[name].present?
end

#tenant?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'app/models/effective/resources/tenants.rb', line 7

def tenant?
  defined?(::Tenant)
end