|
|
|
@@ -44,7 +44,7 @@ class Journal < ApplicationRecord |
|
|
|
belongs_to :reply_journal, class_name: 'Journal', foreign_key: :reply_id, optional: true |
|
|
|
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 :first_ten_children_journals, -> { order(created_on: :asc).limit(20)}, 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)} |
|
|
|
|