Tag: 标记云

从Scratch标记:标签云问题

我按照http://railscasts.com/episodes/382-tagging的说明并从Scratch构建标签系统。 一切都很好,但不是tag_cloud助手。 它在搜索tag_counts时引发数据库错误。 以下范围: #Picture.rb class Picture < ActiveRecord::Base attr_accessible :description, :title, :tag_list has_many :taggings has_many :tags, through: :taggings #Because of the following I'm getting an error from the Posgresql (showed in "Database Error") def self.tag_counts Tag.select("tags.*, count(taggings.tag_id) as count"). joins(:taggings).group("taggings.tag_id") end end Application_helper.rb def tag_cloud(tags, classes) max = tags.sort_by(&:count).last tags.each do |tag| index = […]