File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ function ChainFind(Model, opts) {
45
45
} else {
46
46
omit = Array . prototype . slice . apply ( arguments ) ;
47
47
}
48
- this . only ( _ . difference ( Object . keys ( Model . properties ) , omit ) ) ;
48
+ this . only ( _ . difference ( Object . keys ( Model . allProperties ) , omit ) ) ;
49
49
return this ;
50
50
} ,
51
51
limit : function ( limit ) {
Original file line number Diff line number Diff line change @@ -16,22 +16,26 @@ describe("Model.find() chaining", function() {
16
16
age : Number
17
17
} ) ;
18
18
Person . hasMany ( "parents" ) ;
19
+ Person . hasOne ( "friend" ) ;
19
20
20
21
ORM . singleton . clear ( ) ; // clear cache
21
22
22
23
return helper . dropSync ( Person , function ( ) {
23
24
Person . create ( [ {
24
- name : "John" ,
25
- surname : "Doe" ,
26
- age : 18
25
+ name : "John" ,
26
+ surname : "Doe" ,
27
+ age : 18 ,
28
+ friend_id : 1
27
29
} , {
28
- name : "Jane" ,
29
- surname : "Doe" ,
30
- age : 20
30
+ name : "Jane" ,
31
+ surname : "Doe" ,
32
+ age : 20 ,
33
+ friend_id : 1
31
34
} , {
32
- name : "Jane" ,
33
- surname : "Dean" ,
34
- age : 18
35
+ name : "Jane" ,
36
+ surname : "Dean" ,
37
+ age : 18 ,
38
+ friend_id : 1
35
39
} ] , done ) ;
36
40
} ) ;
37
41
} ;
@@ -215,6 +219,8 @@ describe("Model.find() chaining", function() {
215
219
Person . find ( ) . omit ( "age" , "surname" ) . order ( "-age" ) . run ( function ( err , instances ) {
216
220
should . equal ( err , null ) ;
217
221
instances . should . have . property ( "length" , 3 ) ;
222
+ should . exist ( instances [ 0 ] . id ) ;
223
+ should . exist ( instances [ 0 ] . friend_id ) ;
218
224
instances [ 0 ] . should . have . property ( "age" , null ) ;
219
225
instances [ 0 ] . should . have . property ( "surname" , null ) ;
220
226
instances [ 0 ] . should . have . property ( "name" , "Jane" ) ;
You can’t perform that action at this time.
0 commit comments