Class: MultiTenant::Context
- Inherits:
-
Object
- Object
- MultiTenant::Context
- Defined in:
- lib/activerecord-multi-tenant/query_rewriter.rb
Instance Attribute Summary collapse
-
#arel_node ⇒ Object
readonly
Returns the value of attribute arel_node.
-
#handled_relations ⇒ Object
readonly
Returns the value of attribute handled_relations.
-
#known_relations ⇒ Object
readonly
Returns the value of attribute known_relations.
Instance Method Summary collapse
- #discover_relations ⇒ Object
-
#initialize(arel_node) ⇒ Context
constructor
A new instance of Context.
- #unhandled_relations ⇒ Object
- #visited_handled_relation(relation) ⇒ Object
- #visited_relation(relation) ⇒ Object
Constructor Details
#initialize(arel_node) ⇒ Context
Returns a new instance of Context.
32 33 34 35 36 37 |
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 32 def initialize(arel_node) @arel_node = arel_node @known_relations = [] @handled_relations = [] @discovering = false end |
Instance Attribute Details
#arel_node ⇒ Object (readonly)
Returns the value of attribute arel_node.
30 31 32 |
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 30 def arel_node @arel_node end |
#handled_relations ⇒ Object (readonly)
Returns the value of attribute handled_relations.
30 31 32 |
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 30 def handled_relations @handled_relations end |
#known_relations ⇒ Object (readonly)
Returns the value of attribute known_relations.
30 31 32 |
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 30 def known_relations @known_relations end |
Instance Method Details
#discover_relations ⇒ Object
39 40 41 42 43 44 |
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 39 def discover_relations old_discovering = @discovering @discovering = true yield @discovering = old_discovering end |
#unhandled_relations ⇒ Object
56 57 58 |
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 56 def unhandled_relations known_relations.uniq - handled_relations end |