From 47ca79c3173a5864a7fe0292b122eb3179efe035 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Mar 2016 10:49:17 +0800 Subject: [PATCH] =?UTF-8?q?news=E6=B6=88=E6=81=AF=E5=B7=B2=E8=AF=BB?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/news_controller.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 0962deb10..dbefd82cb 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -108,15 +108,11 @@ class NewsController < ApplicationController def show # 更新news对应的forge_messages的消息viewed字段 if @project - query_message_news = @news.forge_messages + query_message_news = ForgeMessage.where("forge_message_id =? and user_id =?", @news.id, User.current.id).first else - query_message_news = @news.course_messages - end - query_message_news.each do |query| - if User.current.id == query.user_id - query.update_attributes(:viewed => true) - end + query_message_news = CourseMessage.where("course_message_id =? and user_id =?", @news.id, User.current.id).first end + query_message_news.update_attribute(:viewed, true) # 更新项目新闻的评阅的消息viewed字段 current_message_comments = @news.comments current_message_comments.each do |current_message_comment|