Sha256: 85a06b883b15b9ceb1e4c8efdb9074d0fefaf68ebf5674fa692c3b3ba78572d3

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

ActsAsTenant.configure do |config|
  config.require_tenant = true
  # config.require_tenant = lambda do |options|
  #   # if options[:scope] == User && true # global_domain?
  #   #   # tal vez en algunos casos de devise sí requeriría el tenant?
  #   #   #   creería que no, el único lugar en donde se debería queriar
  #   #   #   User es en devise y es para obtener el current_user
  #   #   #   hay que ver luego qué pasa con invitable
  #   #   false
  #   # else
  #   #   true
  #   # end
  # 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

4 entries across 4 versions & 1 rubygems

Version Path
pg_rails-7.5.3 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.5.2 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.5.1 pg_engine/config/initializers/acts_as_tenant.rb
pg_rails-7.5.0 pg_engine/config/initializers/acts_as_tenant.rb