Module: Ekylibre::MultiTenancy::ConsoleHelper

Defined in:
lib/ekylibre/multi_tenancy/console_helper.rb

Overview

Helper methods to switch tenants in the Rails console

Instance Method Summary collapse

Instance Method Details

#leave_tenant!Object



13
14
15
16
# File 'lib/ekylibre/multi_tenancy/console_helper.rb', line 13

def leave_tenant!
  container.get(TenantSwitcher)
           .leave!
end

#switch_tenant(name, &block) ⇒ Object

Parameters:

  • name (String)


19
20
21
22
23
24
# File 'lib/ekylibre/multi_tenancy/console_helper.rb', line 19

def switch_tenant(name, &block)
  return if block.nil?

  container.get(TenantSwitcher)
           .switch(name) { block.call }
end

#switch_tenant!(name) ⇒ Object

Parameters:

  • name (String)


8
9
10
11
# File 'lib/ekylibre/multi_tenancy/console_helper.rb', line 8

def switch_tenant!(name)
  container.get(TenantSwitcher)
           .switch!(name)
end