From 0bcc0beaf1b5d6517b5666c1ea7b9aa135ed6f67 Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 1 Jul 2014 10:31:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=95=99=E8=A8=80=E8=AE=A1?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/journals_for_message.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index f2b69da8..9551ff28 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -117,6 +117,15 @@ class JournalsForMessage < ActiveRecord::Base update_all("m_reply_count = #{count.to_i}", ["id = ?", journals_for_messages.m_parent_id]) end + #如果是在项目中留言则返回该项目否则返回nil - zjc + def project + if self.jour_type == 'Project' + Project.find(self.jour_id) + else + nil + end + end + # 更新用户分数 -by zjc def be_user_score #新建了留言回复