Module: Cell::Console

Defined in:
lib/cell/console.rb

Class Method Summary collapse

Class Method Details

.configure!Object



18
19
20
21
22
# File 'lib/cell/console.rb', line 18

def configure!
  if (t = default_console_tenant)
    ::Cell::Tenant.use(t)
  end
end

.default_console_tenantObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/cell/console.rb', line 5

def default_console_tenant
  return nil unless Rails.env.development? || (ENV['T'] && ENV['T'] != '')
  Rails.application.eager_load!

  if ENV['T']
    Cell::Tenant.cell_find(ENV['T']).tap do |r|
      fail "Couldn't locate tenant: #{ENV['T']}" if r.nil?
    end
  elsif Rails.env.development?
    Cell::Tenant.first
  end
end