Ruby Rails,PostgreSQL-如何计算标记的数量?

Ruby Rails,PostgreSQL-如何计算标记的数量?,ruby,ruby-on-rails-3,count,Ruby,Ruby On Rails 3,Count,我有这些数据库表: 标签 标签 这些表是由gem创建的 我正在尝试获取存储在表标记中的最常用标记的计数,但我不知道如何获取它们 谁能给我一些提示或链接,如何获得这些信息?请看这个问题:太棒了,正是我一直在寻找的! id | integer | not null default nextval('taggings_id_seq'::regclass) | plain | tag_id | integer

我有这些数据库表:

标签

标签

这些表是由gem创建的

我正在尝试获取存储在表标记中的最常用标记的计数,但我不知道如何获取它们


谁能给我一些提示或链接,如何获得这些信息?

请看这个问题:太棒了,正是我一直在寻找的!
 id            | integer                     | not null default nextval('taggings_id_seq'::regclass) | plain    | 
 tag_id        | integer                     |                                                       | plain    | 
 taggable_id   | integer                     |                                                       | plain    | 
 taggable_type | character varying(255)      |                                                       | extended | 
 tagger_id     | integer                     |                                                       | plain    | 
 tagger_type   | character varying(255)      |                                                       | extended | 
 context       | character varying(128)      |                                                       | extended | 
 created_at    | timestamp without time zone |                                                       | plain    | 
id      | integer                | not null default nextval('tags_id_seq'::regclass) | plain    | 
 name   | character varying(255) |                                                   | extended |