Class: DynamicLinks::ApplicationController

Inherits:
ActionController::API
  • Object
show all
Defined in:
app/controllers/dynamic_links/application_controller.rb

Direct Known Subclasses

RedirectsController

Instance Method Summary collapse

Instance Method Details

#multi_tenant(client, db_infra_strategy = DynamicLinks.configuration.db_infra_strategy) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/dynamic_links/application_controller.rb', line 3

def multi_tenant(client, db_infra_strategy = DynamicLinks.configuration.db_infra_strategy)
  if db_infra_strategy == :sharding
    if defined?(::MultiTenant)
      ::MultiTenant.with(client) do
        yield
      end
    else
      Rails.logger.warn 'MultiTenant gem is not installed. Please install it to use sharding strategy'
      yield
    end
  else
    yield
  end
end