测试版发布课程通知和讨论区发布新帖报500

This commit is contained in:
lizanle 2015-03-06 11:38:32 +08:00
parent 8d322edb90
commit 140cb81748
2 changed files with 10 additions and 4 deletions

View File

@ -164,8 +164,11 @@ class Message < ActiveRecord::Base
# Author lizanle
# Description
def act_as_forge_activity
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
:project_id => self.board.project.id)
# 如果project为空那么就是课程相关的消息
if !self.board.project.nil?
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
:project_id => self.board.project.id)
end
end
#更新用户分数 -by zjc

View File

@ -98,8 +98,11 @@ class News < ActiveRecord::Base
# Author lizanle
# Description 公用表中也要记录
def act_as_forge_activity
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
:project_id => self.project.id)
# 如果是project为空那么是课程相关的不需要保存
if !self.project.nil?
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
:project_id => self.project.id)
end
end
end