I have a rails application that works fine with actions_as_votable. Such a button increases the number of columns, and then switches to the un-like button, and this makes it possible to count the number of messages.
My problem is that since I started using the pearl of Public Activity, I can’t find a way to remove the ones I like from the feed. I used the following loop in an activity index view:
<% @activities.each do |activity| %>
<p>
<% if activity.trackable %>
<%= link_to activity.owner.name, activity.owner %>
<%= render_activity activity %>
<% end %>
</p>
<% end %>
When I delete a comment, the entire line in the activity feed “FOO added comment to BAR” disappears. However, since the actions being the voting gem actually create a downward movement rather than destroying the top line, the “FOO like BAR” line still appears, followed by the “FOO unliked BAR”.
Does anyone know how I can find the top point of current_user on a specific post and then destroy it?
Below is the code of my controller, for example, and in contrast to it:
def like
@ink.create_activity :like, owner: current_user
@ink.upvote_by current_user
redirect_to :back
end
def unlike
@ink.downvote_by current_user
redirect_to :back
end
thank
source
share