class MultiTenant::BaseTenantEnforcementClause

Attributes

tenant_attribute[R]

Public Class Methods

new(tenant_attribute) click to toggle source
# File lib/activerecord-multi-tenant/query_rewriter.rb, line 156
def initialize(tenant_attribute)
  @tenant_attribute = tenant_attribute
  @tenant_model = MultiTenant.multi_tenant_model_for_table(tenant_attribute.relation.table_name)
end

Public Instance Methods

to_s() click to toggle source
# File lib/activerecord-multi-tenant/query_rewriter.rb, line 161
def to_s; to_sql; end
to_sql(*) click to toggle source
# File lib/activerecord-multi-tenant/query_rewriter.rb, line 164
def to_sql(*)
  collector = Arel::Collectors::SQLString.new
  collector = @tenant_model.connection.visitor.accept tenant_arel, collector
  collector.value
end
to_str() click to toggle source
# File lib/activerecord-multi-tenant/query_rewriter.rb, line 162
def to_str; to_sql; end