From f05cf0c000a181447b27c46724c8ba0454ba5530 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 27 Feb 2023 14:12:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/journal.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/journal.rb b/app/models/journal.rb index 6472d559d..57f53c125 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -45,7 +45,7 @@ class Journal < ApplicationRecord has_many :journal_details, :dependent => :delete_all has_many :attachments, as: :container, dependent: :destroy has_many :first_ten_children_journals, -> { order(created_on: :asc).limit(10)}, class_name: 'Journal', foreign_key: :parent_id - has_many :children_journals, class_name: 'Journal', foreign_key: :parent_id + has_many :children_journals, class_name: 'Journal', foreign_key: :parent_id, dependent: :destroy scope :journal_includes, ->{includes(:user, :journal_details, :attachments)} scope :parent_journals, ->{where(parent_id: nil)}