jugglingdb icon indicating copy to clipboard operation
jugglingdb copied to clipboard

Return data on async getter (include) for hasMany

Open absynce opened this issue 10 years ago • 1 comments

I added behavior to return data on async getter (include) for hasMany, e.g. user.posts(c) returns Array, to be consistent with belongsTo behavior.

User.all({ include: 'posts' }, function (err, users) { 
   var userPosts = users[0].posts(function () { }); // Returns Array of posts for users[0].
});

@1602 where should I test this? I initially thought scope.test.js since it's a change in that file but include.test.js looks like it is closer in setup. Although it doesn't appear to test public API behavior.

absynce avatar Jun 27 '14 20:06 absynce