Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return data on async getter (include) for hasMany #407

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

absynce
Copy link
Contributor

@absynce absynce commented Jun 27, 2014

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.

@1602
Copy link
Owner

1602 commented Jun 28, 2014

@absynce i think include.test.js is the right place because this scope method relies on include clause. Don't worry about existing tests, just organize them in natural way (you may want to add another tests section for that feature)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants