methods for counting relations
Closed this issue · 1 comments
maxwell commented
Hey,
It would be awesome if there was some built in methods to count relationships...
For example
Tag.taggings.count # returns the amount of places this tag is uses, across sets.
I realize this might be a slightly more complicated query as you might need to do some join magic, but it would be nice to have it built in the gem
ebobby commented
You can do that now in version 1.0.1.
Quoting the README:
# The child model can also see to which parent models it relates to
Tag.first.articles.size
=> 503
Is this what you mean?