markbates / mongoid-tags-arent-hard

A tagging gem for Mongoid 3 that doesn't actually suck.
MIT License
16 stars 12 forks source link

Add #all_tags_counts method that returns distinct tag names and their usage count #5

Open cblock opened 11 years ago

cblock commented 11 years ago

This should return an array of arrays of the form:

[ ['tag_name_1',12], ['tag name 2', 1], [...] ]

It should work within scoped queries

Foo.all_tags_counts
Foo.where(name: 'test').all_tags_counts
Foo.all_colors_counts
Foo.where(name: 'test').all_colors_counts

...and mabye there's a better name for this method?

cblock commented 11 years ago

...just revised the issue description so that it better conforms to the tag naming convention.

markbates commented 11 years ago

I'll happily accept a pull request for this.