Class: MultiTenant::BaseTenantEnforcementClause
- Inherits:
-
Arel::Nodes::Node
- Object
- Arel::Nodes::Node
- MultiTenant::BaseTenantEnforcementClause
show all
- Defined in:
- lib/activerecord-multi-tenant/query_rewriter.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of BaseTenantEnforcementClause.
179
180
181
182
183
184
185
|
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 179
def initialize(tenant_attribute)
super()
@tenant_attribute = tenant_attribute
@tenant_model = MultiTenant.multi_tenant_model_for_table(
MultiTenant::TableNode.table_name(tenant_attribute.relation)
)
end
|
Instance Attribute Details
#tenant_attribute ⇒ Object
Returns the value of attribute tenant_attribute.
177
178
179
|
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 177
def tenant_attribute
@tenant_attribute
end
|
Instance Method Details
#to_s ⇒ Object
187
188
189
|
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 187
def to_s
to_sql
end
|
#to_sql ⇒ Object
195
196
197
198
199
|
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 195
def to_sql(*)
collector = Arel::Collectors::SQLString.new
collector = @tenant_model.connection.visitor.accept tenant_arel, collector
collector.value
end
|
#to_str ⇒ Object
191
192
193
|
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 191
def to_str
to_sql
end
|