修改用户活动的问题

This commit is contained in:
fanqiang 2013-08-12 21:39:58 +08:00
parent 47b77eedfb
commit eef2d8ef1a
1 changed files with 7 additions and 3 deletions

View File

@ -212,9 +212,13 @@ class UsersController < ApplicationController
# @activity_pages = Paginator.new @activity_count, @limit, params['page']
# @offset ||= @activity_pages.offset
# @events_by_day_ = @events.slice(@offset,@limit)
watcher = User.watched_by(@user)
watcher.push(User.current)
activity = Activity.where('user_id in (?)', watcher).order('id desc')
if @user == User.current
watcher = User.watched_by(@user)
watcher.push(User.current)
activity = Activity.where('user_id in (?)', watcher).order('id desc')
else
activity = Activity.where('user_id = ?', @user.id).order('id desc')
end
@offset, @limit = api_offset_and_limit({:limit => 10})
@activity_count = activity.count
@activity_pages = Paginator.new @activity_count, @limit, params['page']