Merge branch 'dev_hjq' of http://repository.trustie.net/xianbo/trustie2 into dev_hjq

This commit is contained in:
ouyangxuhua 2015-08-17 15:07:56 +08:00
commit 7ae44af0ab
1 changed files with 4 additions and 5 deletions

View File

@ -114,14 +114,13 @@ class UsersController < ApplicationController
else
case params[:type]
when 'homework'
@user_course_messages = @user.course_messages.reverse.select{|x| x.course_message_type == "HomeworkCommon"}
#@user_course_messages = ForgeMessage.find_by_sql("select * from course_messages where user_id='#{@user.id}' and course_message_type = 'HomeworkCommon' order by created_at desc;")
@user_course_messages = CourseMessage.where(:course_message_type => "HomeworkCommon", :user_id => @user)
when 'message'
@user_course_messages = @user.course_messages.reverse.select{|x| x.course_message_type == "Message"}
@user_course_messages = CourseMessage.where(:course_message_type => "Message", :user_id => @user)
when 'news'
@user_course_messages = @user.course_messages.reverse.select{|x| x.course_message_type == "News"}
@user_course_messages = CourseMessage.where(:course_message_type => "News", :user_id => @user)
when 'poll'
@user_course_messages = @user.course_messages.reverse.select{|x| x.course_message_type == "Poll"}
@user_course_messages = CourseMessage.where(:course_message_type => "Poll", :user_id => @user)
end
end
respond_to do |format|