Sha256: b22f1005b784a1e21036ff47f2d049897d61af06ebb9f0b84d9a2165cabed5b2

Contents?: true

Size: 800 Bytes

Versions: 23

Compression:

Stored size: 800 Bytes

Contents

ActsAsTenant.configure do |config|
  config.require_tenant = lambda do |options|
    Current.namespace.present? || !options[:model].in?([User, UserAccount, Email, EmailLog])
  end

  # Customize the query for loading the tenant in background jobs
  # config.job_scope = ->{ all }
end

SET_TENANT_PROC = lambda do
  if defined?(Rails::Console)
    puts "> ActsAsTenant.current_tenant = Account.first"
    ActsAsTenant.current_tenant = Account.first
  end
end

Rails.application.configure do
  if Rails.env.development?
    # Set the tenant to the first account in development on load
    config.after_initialize do
      SET_TENANT_PROC.call
    end

    # Reset the tenant after calling 'reload!' in the console
    ActiveSupport::Reloader.to_complete do
      SET_TENANT_PROC.call
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
pg_rails-7.6.20 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.19 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.18 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.17 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.16 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.15 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.14 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.13 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.12 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.11 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.10 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.9 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.8 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.7 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.6 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.5 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.4 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.3 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.2 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.6.1 pg_engine/config/initializers/acts_as_tenant.rb