File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -804,7 +804,7 @@ module.exports = function(AV) {
804804 options = arguments [ 1 ] || { } ;
805805 }
806806
807- if ( fetchOptions && fetchOptions . include && fetchOptions . include . length > 0 ) {
807+ if ( fetchOptions && fetchOptions . include && _ . isArray ( fetchOptions . include ) ) {
808808 fetchOptions . include = fetchOptions . include . join ( ',' ) ;
809809 }
810810
Original file line number Diff line number Diff line change @@ -363,6 +363,19 @@ describe('Objects', function(){
363363 } ) ;
364364 } ) ;
365365
366+ it ( 'should compatible with previous include option of fetch' , function ( ) {
367+ var myPost = new Post ( ) ;
368+ myPost . set ( 'author1' , new Person ( { name : '1' } ) ) ;
369+ myPost . set ( 'author2' , new Person ( { name : '2' } ) ) ;
370+ return myPost . save ( ) . then ( function ( ) {
371+ myPost = AV . Object . createWithoutData ( 'Post' , myPost . id ) ;
372+ return myPost . fetch ( { include : 'author1, author2' } , { } ) . then ( function ( ) {
373+ expect ( myPost . get ( 'author1' ) . get ( 'name' ) ) . to . be ( '1' ) ;
374+ expect ( myPost . get ( 'author2' ) . get ( 'name' ) ) . to . be ( '2' ) ;
375+ } ) ;
376+ } ) ;
377+ } ) ;
378+
366379 /*
367380
368381 it("it should fetch relation post",function(done){
You can’t perform that action at this time.
0 commit comments