From ad092d91e1b1ad5feb9d7256f0b988b07958775b Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 2 Jul 2019 16:14:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/repertoire.rb | 2 +- app/models/sub_repertoire.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/repertoire.rb b/app/models/repertoire.rb index 5c6ffebff..995d52d0b 100644 --- a/app/models/repertoire.rb +++ b/app/models/repertoire.rb @@ -1,6 +1,6 @@ class Repertoire < ApplicationRecord default_scope :order => 'updated_at desc' - has_many :sub_repertoires, :dependent => :destroy, :order => "sub_repertoires.updated_at desc" + has_many :sub_repertoires, ->{order("sub_repertoires.updated_at desc")}, :dependent => :destroy has_many :tag_repertoires, through: :sub_repertoires end diff --git a/app/models/sub_repertoire.rb b/app/models/sub_repertoire.rb index aa99494b1..9f7079cfc 100644 --- a/app/models/sub_repertoire.rb +++ b/app/models/sub_repertoire.rb @@ -1,5 +1,5 @@ class SubRepertoire < ApplicationRecord belongs_to :repertoire - has_many :tag_repertoires, :dependent => :destroy, :order => "tag_repertoires.updated_at desc" + has_many :tag_repertoires, ->{order("tag_repertoires.updated_at desc")} ,:dependent => :destroy end