views:

29

answers:

1

I am using the plugin:

http://github.com/karmi/is_taggable

How can I perform simple statistics on my tags, e.g. what's the most used tag? which tags are not used, etc.?

With SQL I would do something like:

select id, count(*) from taggings group by taggable_id;

But I am not seeing how to do this with the plugin.

Thanks!

+1  A: 

Try Tag.count(:conditions => ["name = ?", tagname]) where tagname is what you're searching for. Since Tag is an active record model all the methods work.

Sandman
thanks.. this pointed in the right direction. I can use:Tagging.count(:conditions => ["tag_id = ?", tagid]) to have an overview on tag_ids usage
poseid