class MultiTenant::TenantsNotFound

Attributes

tenant_class[R]

Public Class Methods

new(tenant_class, identifiers, found_records) click to toggle source
# File lib/acts_as_multi_tenant.rb, line 15
def initialize(tenant_class, identifiers, found_records)
  @tenant_class = tenant_class
  @identifiers = identifiers
  @found_records = found_records
end

Public Instance Methods

message() click to toggle source
# File lib/acts_as_multi_tenant.rb, line 32
def message
  "The following #{@tenant_class.name} tenants could not be found: #{not_found.join ", "}"
end
not_found() click to toggle source

Returns an array of the tenant identifiers that could not be found

# File lib/acts_as_multi_tenant.rb, line 22
def not_found
  @not_found ||= @identifiers.map(&:to_s) - @found_records.map { |tenant|
    tenant.send(@tenant_class.tenant_identifier).to_s
  }
end
to_s() click to toggle source
# File lib/acts_as_multi_tenant.rb, line 28
def to_s
  message
end