class Object

Public Instance Methods

reload!(print = true) click to toggle source

reloads the environment rubocop:disable Style/OptionalBooleanParameter

# File lib/apartment/console.rb, line 8
def reload!(print = true)
  puts 'Reloading...' if print

  # This triggers the to_prepare callbacks
  ActionDispatch::Callbacks.new(proc {}).call({})
  # Manually init Apartment again once classes are reloaded
  Apartment::Tenant.init
  true
end
st(schema_name = nil) click to toggle source

rubocop:enable Style/OptionalBooleanParameter

# File lib/apartment/console.rb, line 19
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_msg() click to toggle source
# File lib/apartment/console.rb, line 37
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_list() click to toggle source
# File lib/apartment/console.rb, line 31
def tenant_list
  tenant_list = [Apartment.default_tenant]
  tenant_list += Apartment.tenant_names
  tenant_list.uniq
end