Count on relation should work for belongsToMany relations.
- Related Issues: #1075
Introduction
When calling count on a relationship collection, if the relation is belongsToMany, count returns the count of the entire table instead of just the related entries. The belongsToMany case did not seem to be handled at all previously in sync.js.
Motivation
Describe the problems that this proposal seeks to address and why it's important. If it's completely new functionality explain why this new functionality is necessary.
Proposed solution
Describe your solution to the problem. If possible provide examples and describe how they work. Show why your solution is better than what's currently available: is it cleaner, safer, or more efficient?
Current PR Issues
Are there any known issues in this Pull Request? This will help others understand if more work will be needed.
Alternatives considered
Describe any alternative approaches to addressing the same problem that you have thought about, and why you chose this approach instead.
Will do!
@ricardograca, fixed the linter issue and added a test that seems to be passing. Not sure why the build is failing, could you take a look when you get the chance?
Thanks! One of the jobs just hanged and timed out without any errors at the end, so I just restarted it. I'll check the code later.