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.
31 32 33 34 35 36 |
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 31 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.
29 30 31 |
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 29 def arel_node @arel_node end |
#handled_relations ⇒ Object (readonly)
Returns the value of attribute handled_relations.
29 30 31 |
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 29 def handled_relations @handled_relations end |
#known_relations ⇒ Object (readonly)
Returns the value of attribute known_relations.
29 30 31 |
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 29 def known_relations @known_relations end |
Instance Method Details
#discover_relations ⇒ Object
38 39 40 41 42 43 |
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 38 def discover_relations old_discovering = @discovering @discovering = true yield @discovering = old_discovering end |
#unhandled_relations ⇒ Object
54 55 56 |
# File 'lib/activerecord-multi-tenant/query_rewriter.rb', line 54 def unhandled_relations known_relations.uniq - handled_relations end |