将public_activity与acts_as_follower和devise一起使用,我如何只显示用户的活动以及他所关注的人的活动?

我正在尝试获取基于public_activity gem的通知控制器,以显示用户的活动以及他所遵循的活动。

我有它的工作,以显示用户遵循的活动,但我似乎无法让用户自己的活动被包括在内。

换句话说,这有效:

class NotificationsController  current_user.following_users, :owner_type => 'User').order('created_at DESC') end end 

虽然这不是:

 class NotificationsController < CooperativeController before_filter :authenticate_user! def index notify_user_of = current_user.following_users notify_user_of < notify_user_of, :owner_type => 'User').order('created_at DESC') end end 

事实certificate, notify_user_of = current_user.following_users不是我想象的数组,而是一个活动的记录对象。 通过手动创建arrays并向其添加单个用户,我能够实现所需的结果。

 ... notify_user_of = [] notify_user_of << current_user for user in current_user.following_users notify_user_of << user end ...