socialforge/db/migrate/20150831070611_about_memo_m...

37 lines
1.0 KiB
Ruby

class AboutMemoMessage < ActiveRecord::Migration
def up
# Memo.all.each do |memo|
# transaction do
# # 贴吧帖子
# receivers = []
# u = User.find(6)
# receivers << u
# # 主贴
# if memo.parent_id.nil?
# if memo.author_id != memo.forum.creator_id # 发帖人不是吧主
# receivers << memo.forum.creator
# end
# else # 回帖
# # 添加吧主
# if memo.author_id != memo.forum.creator_id
# receivers << memo.forum.creator
# end
# # 添加发帖人
# unless memo.parent.nil?
# if memo.author_id != memo.parent.author_id
# receivers << memo.parent.author
# puts memo.id
# end
# end
# end
# receivers.each do |r|
# memo.memo_messages << MemoMessage.new(:user_id => r.id, :forum_id => memo.forum_id, :memo_id => memo.id, :memo_type => "Memo", :viewed => true)
# end
# end
# end
end
def down
end
end