module Ekylibre::MultiTenancy::ConsoleHelper

Helper methods to switch tenants in the Rails console

Public Instance Methods

leave_tenant!() click to toggle source
# File lib/ekylibre/multi_tenancy/console_helper.rb, line 13
def leave_tenant!
  container.get(TenantSwitcher)
           .leave!
end
switch_tenant(name, &block) click to toggle source

@param [String] name

# 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) click to toggle source

@param [String] name

# File lib/ekylibre/multi_tenancy/console_helper.rb, line 8
def switch_tenant!(name)
  container.get(TenantSwitcher)
           .switch!(name)
end