Creating page for activity feed that only shows likes by others on my own posts

47 views
Skip to first unread message

eddiec...@gmail.com

unread,
Oct 29, 2015, 12:10:54 PM10/29/15
to Public Activity
I have been trying to figure out how to make it so that I can create a notifications/activity page that lists out likes by other users on your OWN individual posts. In my case, I have no friend or following system so literally anyone who signs up can like a post. I have been looking everywhere and cannot find an example of how it is done. Please help. Thanks so much.

Jakub Okoński

unread,
Oct 29, 2015, 12:15:45 PM10/29/15
to eddiec...@gmail.com, Public Activity
How about: `PublicActivity::Activity.where(trackable_type: "Post", trackable_id: current_user.post_ids, key: "post.like")`?

On 29 October 2015 at 17:10, <eddiec...@gmail.com> wrote:
I have been trying to figure out how to make it so that I can create a notifications/activity page that lists out likes by other users on your OWN individual posts. In my case, I have no friend or following system so literally anyone who signs up can like a post. I have been looking everywhere and cannot find an example of how it is done. Please help. Thanks so much.

--
You received this message because you are subscribed to the Google Groups "Public Activity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to public-activi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Piotrek Okoński

unread,
Oct 29, 2015, 12:16:22 PM10/29/15
to Jakub Okoński, eddiec...@gmail.com, Public Activity
Yeah that will fetch the activities related to your posts.

Eddie Campain

unread,
Nov 2, 2015, 12:44:09 AM11/2/15
to Piotrek Okoński, Jakub Okoński, Public Activity
Thanks I have two questions.

Would I need to run a migration that assigns a post id to a post? 

Also, I currently do not have a Like controller/model, instead I simply defined a Like method in my posts controller. Is this the smartest way to go about this?
Reply all
Reply to author
Forward
0 new messages