Top Level Namespace

Defined Under Namespace

Modules: ActiveRecord, Apartment Classes: InternalMetadata

Instance Method Summary collapse

Instance Method Details

#st(schema_name = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/apartment/console.rb', line 3

def st(schema_name = nil)
  if schema_name.nil?
    tenant_list.each { |t| puts t }

  elsif tenant_list.include? schema_name
    Apartment::Tenant.switch!(schema_name)
  else
    puts "Tenant #{schema_name} is not part of the tenant list"

  end
end

#tenant_info_msgObject



21
22
23
24
# File 'lib/apartment/console.rb', line 21

def tenant_info_msg
  puts "Available Tenants: #{tenant_list}\n"
  puts "Use `st 'tenant'` to switch tenants & `tenant_list` to see list\n"
end

#tenant_listObject



15
16
17
18
19
# File 'lib/apartment/console.rb', line 15

def tenant_list
  tenant_list = [Apartment.default_tenant]
  tenant_list += Apartment.tenant_names
  tenant_list.uniq
end