@@ -158,6 +158,13 @@ function Model(opts) {
158
158
conditions [ opts . keys [ i ] ] = ids [ i ] ;
159
159
}
160
160
161
+ if ( ! options . hasOwnProperty ( "autoFetchLimit" ) ) {
162
+ options . autoFetchLimit = opts . autoFetchLimit ;
163
+ }
164
+ if ( ! options . hasOwnProperty ( "cascadeRemove" ) ) {
165
+ options . cascadeRemove = opts . cascadeRemove ;
166
+ }
167
+
161
168
opts . driver . find ( model_fields , opts . table , conditions , { limit : 1 } , function ( err , data ) {
162
169
if ( err ) {
163
170
return cb ( err ) ;
@@ -172,8 +179,8 @@ function Model(opts) {
172
179
return createInstance ( data [ 0 ] , {
173
180
autoSave : opts . autoSave ,
174
181
autoFetch : ( options . autoFetchLimit === 0 ? false : opts . autoFetch ) ,
175
- autoFetchLimit : options . autoFetchLimit || opts . autoFetchLimit ,
176
- cascadeRemove : options . cascadeRemove || opts . cascadeRemove
182
+ autoFetchLimit : options . autoFetchLimit ,
183
+ cascadeRemove : options . cascadeRemove
177
184
} , cb ) ;
178
185
} , function ( instance ) {
179
186
return cb ( null , instance ) ;
@@ -237,6 +244,12 @@ function Model(opts) {
237
244
if ( ! options . hasOwnProperty ( "cache" ) ) {
238
245
options . cache = opts . cache ;
239
246
}
247
+ if ( ! options . hasOwnProperty ( "autoFetchLimit" ) ) {
248
+ options . autoFetchLimit = opts . autoFetchLimit ;
249
+ }
250
+ if ( ! options . hasOwnProperty ( "cascadeRemove" ) ) {
251
+ options . cascadeRemove = opts . cascadeRemove ;
252
+ }
240
253
241
254
if ( order ) {
242
255
order = Utilities . standardizeOrder ( order ) ;
@@ -261,8 +274,8 @@ function Model(opts) {
261
274
return createInstance ( data , {
262
275
autoSave : opts . autoSave ,
263
276
autoFetch : ( options . autoFetchLimit === 0 ? false : ( options . autoFetch || opts . autoFetch ) ) ,
264
- autoFetchLimit : options . autoFetchLimit || opts . autoFetchLimit ,
265
- cascadeRemove : options . cascadeRemove || opts . cascadeRemove ,
277
+ autoFetchLimit : options . autoFetchLimit ,
278
+ cascadeRemove : options . cascadeRemove ,
266
279
extra : options . extra ,
267
280
extra_info : options . extra_info
268
281
} , cb ) ;
0 commit comments