1class Tag 2 def self.unique_tags 3 ActsAsTaggableOn::Tag 4 .joins(:taggings) 5 .where(taggings: { context: 'tags' }) 6 .order(:name) 7 .distinct 8 end 9end