forked from Trustie/forgeplus
新增:forum_section关系
This commit is contained in:
parent
f5738819f9
commit
955e222f55
|
|
@ -0,0 +1,4 @@
|
|||
class ForumSection < ApplicationRecord
|
||||
has_many :memos, dependent: :destroy
|
||||
|
||||
end
|
||||
|
|
@ -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}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue