This commit is contained in:
parent
ff025e07dd
commit
f05cf0c000
|
@ -45,7 +45,7 @@ class Journal < ApplicationRecord
|
||||||
has_many :journal_details, :dependent => :delete_all
|
has_many :journal_details, :dependent => :delete_all
|
||||||
has_many :attachments, as: :container, dependent: :destroy
|
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(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 :journal_includes, ->{includes(:user, :journal_details, :attachments)}
|
||||||
scope :parent_journals, ->{where(parent_id: nil)}
|
scope :parent_journals, ->{where(parent_id: nil)}
|
||||||
|
|
Loading…
Reference in New Issue