class MultiTenantSupport::FindTenantAccount
Public Class Methods
call(subdomains:, domain:)
click to toggle source
# File lib/multi_tenant_support/find_tenant_account.rb, line 5 def call(subdomains:, domain:) subdomain = subdomains.select do |subdomain| excluded_subdomains.none? do |excluded_subdomain| excluded_subdomain.to_s.downcase == subdomain.to_s.downcase end end.last.presence subdomain ? find_by(subdomain: subdomain) : find_by(domain: domain) end
Private Class Methods
excluded_subdomains()
click to toggle source
# File lib/multi_tenant_support/find_tenant_account.rb, line 25 def excluded_subdomains MultiTenantSupport.app.excluded_subdomains end
find_by(params)
click to toggle source
# File lib/multi_tenant_support/find_tenant_account.rb, line 17 def find_by(params) tenant_account_class.find_by(params) end
tenant_account_class()
click to toggle source
# File lib/multi_tenant_support/find_tenant_account.rb, line 21 def tenant_account_class MultiTenantSupport.model.tenant_account_class_name.constantize end