新增:forum_section关系

This commit is contained in:
yystopf 2026-03-25 14:15:16 +08:00
parent f5738819f9
commit 955e222f55
3 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1,4 @@
class ForumSection < ApplicationRecord
has_many :memos, dependent: :destroy
end

View File

@ -45,6 +45,7 @@ class Memo < ApplicationRecord
include Watchable
belongs_to :author, :class_name => "User", foreign_key: :author_id, counter_cache: true
belongs_to :forum_section, counter_cache: true
enum destroy_status: {common: 0, apply_destroy: 1}

View File

@ -3,7 +3,7 @@ json.apply_destroy memo.apply_destroy?
json.content memo.content
json.cover_url memo.cover_url
json.forum_section_id memo.forum_section_id
json.forum_section_title memo.forum_section_title
json.forum_section_title memo.forum_section&.title
json.id memo.id
json.is_fine memo.is_fine
json.is_original memo.is_original