Ruby on Rails Wednesday, March 2, 2016

Colin Law wrote in post #1181847:
> On 2 March 2016 at 18:47, David Williams <lists@ruby-forum.com> wrote:
>> Post.where(user_id:following_ids).order("created_at
>> desc").paginate(page:params[:page])
>
> Also, assuming that you have User has_many following_users and User
> has_many posts then you should be able to say something like
> User has_many following_posts through following_users ...
> You will need a bit more on the end get it to work, not exactly sure
> what you need there. Perhaps someone else will know exactly what you
> need. Then you will be able to say
> current_user.following_posts
> to get all those posts.
>
> So you will be able to say
> @following_activities = (current_user.posts +
> current_user.following_posts).sort....
>
> Colin

Thanks for responding guys. Right now, I'm using the methods that are
included with the Acts_As_Follower Gem.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/46c7c09698ee08d433d2bf90bb299f27%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment