课程导语从帖子中获取

This commit is contained in:
huang 2016-02-22 15:34:50 +08:00
parent efff99c05b
commit 1234bc0aef
1 changed files with 3 additions and 2 deletions

View File

@ -67,8 +67,9 @@ class CourseActivity < ActiveRecord::Base
# 导语
def add_course_lead
if self.course_act_type == "Course"
name = Redmine::Configuration['course_message_lead_subject']
content = Redmine::Configuration['course_message_lead_content']
lead_message = Message.find(12440)
name = lead_message.subject
content = lead_message.content
# message的status状态为0为正常为1表示创建课程时发送的message
message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => self.course.tea_id , :sticky => true, :status => true )
# 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一直