parent
7038608c14
commit
b7578443ae
@ -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…
Reference in new issue