I would like to order article tags on my index page by popularity, and not by creation date, i.e. tags with the highest number of articles in them from the highest to the lowest. My model is as follows:
class Tag < ActiveRecord::Base attr_accessible :name validates :name, :uniqueness => true # order by creation default_scope :order => 'created_at DESC' has_many :taggings, :dependent => :destroy has_many :articles, :through => :taggings end
source share