Top Level Namespace
Defined Under Namespace
Modules: ActiveRecord, Apartment Classes: InternalMetadata
Instance Method Summary collapse
-
#reload!(print = true) ⇒ Object
reloads the environment rubocop:disable Style/OptionalBooleanParameter.
-
#st(schema_name = nil) ⇒ Object
rubocop:enable Style/OptionalBooleanParameter.
- #tenant_info_msg ⇒ Object
- #tenant_list ⇒ Object
Instance Method Details
#reload!(print = true) ⇒ Object
reloads the environment rubocop:disable Style/OptionalBooleanParameter
8 9 10 11 12 13 14 15 16 |
# 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) ⇒ Object
rubocop:enable Style/OptionalBooleanParameter
19 20 21 22 23 24 25 26 27 28 29 |
# 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 ⇒ Object
37 38 39 40 |
# 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 ⇒ Object
31 32 33 34 35 |
# File 'lib/apartment/console.rb', line 31 def tenant_list tenant_list = [Apartment.default_tenant] tenant_list += Apartment.tenant_names tenant_list.uniq end |