diff --git a/app/models/repertoire.rb b/app/models/repertoire.rb index 400cef494..5c6ffebff 100644 --- a/app/models/repertoire.rb +++ b/app/models/repertoire.rb @@ -1,6 +1,6 @@ class Repertoire < ApplicationRecord - - has_many :sub_repertoires + default_scope :order => 'updated_at desc' + has_many :sub_repertoires, :dependent => :destroy, :order => "sub_repertoires.updated_at desc" has_many :tag_repertoires, through: :sub_repertoires end diff --git a/app/models/sub_repertoire.rb b/app/models/sub_repertoire.rb index d94db66c7..aa99494b1 100644 --- a/app/models/sub_repertoire.rb +++ b/app/models/sub_repertoire.rb @@ -1,3 +1,5 @@ class SubRepertoire < ApplicationRecord - has_many :tag_repertoires + belongs_to :repertoire + has_many :tag_repertoires, :dependent => :destroy, :order => "tag_repertoires.updated_at desc" + end