This commit is contained in:
yystopf 2023-02-27 14:12:25 +08:00
parent ff025e07dd
commit f05cf0c000
1 changed files with 1 additions and 1 deletions

View File

@ -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)}