diff --git a/lib/activerecord-multi-tenant/query_rewriter.rb b/lib/activerecord-multi-tenant/query_rewriter.rb
index <HASH>..<HASH> 100644
--- a/lib/activerecord-multi-tenant/query_rewriter.rb
+++ b/lib/activerecord-multi-tenant/query_rewriter.rb
@@ -31,6 +31,7 @@ module MultiTenant
       @arel_node = arel_node
       @known_relations = []
       @handled_relations = []
+      @discovering = false
     end
 
     def discover_relations
init discovering instance var in Context to false to fix warning