File tree 2 files changed +23
-1
lines changed
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ def default_scopable?
117
117
# @since 3.0.0
118
118
def queryable
119
119
crit = Threaded . current_scope ( self ) || Criteria . new ( self )
120
- crit . embedded = true if crit . klass . embedded?
120
+ crit . embedded = true if ( crit . klass . embedded? && ! crit . klass . cyclic? )
121
121
crit
122
122
end
123
123
Original file line number Diff line number Diff line change 21
21
it "sets cyclic to true" do
22
22
expect ( document . cyclic ) . to be true
23
23
end
24
+
25
+ context "when a query is executed" do
26
+
27
+ before do
28
+ document . save
29
+ end
30
+
31
+ it "queries the database, not memory" do
32
+ expect ( Role . first ) . to be_a ( Role )
33
+ end
34
+ end
24
35
end
25
36
26
37
context "when the name is not inflected easily" do
@@ -133,6 +144,17 @@ def is_root?
133
144
expect ( document . class . relations [ 'child_mango' ] ) . to be_cascading_callbacks
134
145
end
135
146
end
147
+
148
+ context "when a query is executed" do
149
+
150
+ before do
151
+ document . save
152
+ end
153
+
154
+ it "queries the database, not memory" do
155
+ expect ( Shelf . first ) . to be_a ( Shelf )
156
+ end
157
+ end
136
158
end
137
159
138
160
context "when building a namespaced hierarchy" do
You can’t perform that action at this time.
0 commit comments