交流问答增加通知公告tab

dev_ec
cxt 5 years ago
parent 7038608c14
commit b7578443ae

@ -25,9 +25,9 @@ class MemosController < ApplicationController
!search.blank? ? "forum_id = #{forum_id} and root_id is null and subject like '%#{search}%'" : !search.blank? ? "forum_id = #{forum_id} and root_id is null and subject like '%#{search}%'" :
"forum_id = #{forum_id} and root_id is null" "forum_id = #{forum_id} and root_id is null"
elsif !search.blank? elsif !search.blank?
"forum_id in(3, 5) and root_id is null and subject like '%#{search}%'" "forum_id in(3, 5, 16) and root_id is null and subject like '%#{search}%'"
else else
"forum_id in(3, 5) and root_id is null" "forum_id in(3, 5, 16) and root_id is null"
end end
if tag_repertoire_id if tag_repertoire_id

@ -1,6 +1,6 @@
module MemosHelper module MemosHelper
def forum_list def forum_list
[{id: 5, name: "技术分享"}, {id: 3, name: "操作指南"}] [{id: 5, name: "技术分享"}, {id: 3, name: "操作指南"}, {id: 16, name: "通知公告"}]
end end
end end

@ -1,2 +1,3 @@
class Forum < ApplicationRecord class Forum < ApplicationRecord
has_many :memos, dependent: :destroy
end end

@ -0,0 +1,9 @@
class MigrateForumName < ActiveRecord::Migration[5.2]
def change
forum = Forum.find_by(id: 16)
if forum.present?
forum.update_attributes(name: "通知公告")
forum.memos.destroy_all
end
end
end
Loading…
Cancel
Save