class Repertoire < ApplicationRecord default_scope :order => 'updated_at desc' has_many :sub_repertoires, ->{order("sub_repertoires.updated_at desc")}, :dependent => :destroy has_many :tag_repertoires, through: :sub_repertoires end