From 583c0220483d7e8523335cf40df7288019065afd Mon Sep 17 00:00:00 2001 From: nieguanghui Date: Fri, 1 Nov 2013 10:48:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BD=9C=E4=B8=9A=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=90=9C=E7=B4=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abb9b3079..dd2b5341a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -427,11 +427,13 @@ class UsersController < ApplicationController end if params[:user].present? + user_temp = User.find_by_sql("select id from users where firstname like '%#{params[:user]}%' or lastname like '%#{params[:user]}%'") + if user_temp.size > 1 - activity = Activity.where('user_id in (?)', user_temp).order('id desc') + activity = Activity.where('user_id in (?)', user_temp).where('user_id in (?)', watcher).order('id desc') elsif user_temp.size == 1 - activity = Activity.where('user_id = ?', user_temp).order('id desc') + activity = Activity.where('user_id = ?', user_temp).where('user_id in (?)', watcher).order('id desc') else activity = Activity.where("1 = 0") end