diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index dfa30915e..515b94392 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -852,7 +852,7 @@ class CoursesController < ApplicationController # return # end # 统计访问量 - @course.update_attribute(:visits, @course.visits.to_i + 1) + @course.update_column(:visits, @course.visits.to_i + 1) #更新创建课程消息状态 create_course_messages = @course.course_messages.where("user_id =? and course_message_type =? and course_id =? and viewed =?", User.current.id, 'Course', @course.id, 0) create_course_messages.update_all(:viewed => true) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index f74350672..fe7d4bbe5 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -295,11 +295,13 @@ class ProjectsController < ApplicationController def show # 更新消息为已读 update_message_status(User.current, @project) + # over if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) return end # 统计访问量 - @project.update_attribute(:visits, @project.visits.to_i + 1) + @project.update_column(:visits, @project.visits + 1) + # over @author = params[:user_id].blank? ? nil : User.active.find(params[:user_id]) @page = params[:page] ? params[:page].to_i + 1 : 0 # 根据私密性,取出符合条件的所有数据 @@ -321,8 +323,6 @@ class ProjectsController < ApplicationController = ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc") .page(params['page'|| 1]).per(10); end - boards = @project.boards.includes(:last_message => :author).all - @topic_count = @project.boards.count # 根据对应的请求,返回对应的数据 respond_to do |format| format.html