Class: MultiTenant::TenantJoinEnforcementClause

Inherits:
Arel::Nodes::Node
  • Object
show all
Defined in:
lib/activerecord-multi-tenant/query_rewriter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tenant_attribute, table_left) ⇒ TenantJoinEnforcementClause

Returns a new instance of TenantJoinEnforcementClause.



180
181
182
183
184
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 180

def initialize(tenant_attribute, table_left)
  @table_left = table_left
  @model_left = MultiTenant.multi_tenant_model_for_table(table_left.table_name)
  @tenant_attribute = tenant_attribute
end

Instance Attribute Details

#table_leftObject (readonly)

Returns the value of attribute table_left.



179
180
181
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 179

def table_left
  @table_left
end

#tenant_attributeObject (readonly)

Returns the value of attribute tenant_attribute.



178
179
180
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 178

def tenant_attribute
  @tenant_attribute
end

Instance Method Details

#to_sObject



186
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 186

def to_s; to_sql; end

#to_sqlObject



189
190
191
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 189

def to_sql(*)
  tenant_arel.to_sql
end

#to_strObject



187
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 187

def to_str; to_sql; end