How do i show a specific book and show all the activity that a uniq user provided with the public_activity gem?
I'm able to show a stream of activity for each user in their profile. What I'm trying to figure out is how i can have a book show one time with the activity that a specific user provided on the side like Favorite, Liked and so on rather then showing the same book multiple times with the activity next to it. How do i show a specific book and show all the activity that a uniq user provided?
This is my UsersController
. I use the @activities
to show the users activity.
class UsersController < ApplicationController
def show
@user = User.friendly.find(params[:id])
@activities = PublicActivity::Activity.order("created_at desc")
.where(owner_id: @user.id, owner_type: "User")
end
end
This is my _activity.html.erb
page
<% @activities.each do |activity| %>
<%= link_to image_tag(activity.trackable.cover_image.url{:large}), activity.trackable.name%>
<%= render_activity activity %>
<% end %>