how to get all the posts upvoted be current user using acts_as_votable gem

41 Views Asked by At

i want to show all the posts users have upvoted on, how can I do this.

1

There are 1 best solutions below

0
mechnicov On BEST ANSWER

Let's say you have such models

class Post < ApplicationRecord
  acts_as_votable
end
class User < ApplicationRecord
  acts_as_voter
end

To get all upvoted posts of some user (e.g. current_user)

current_user.get_up_voted(Post)

Please also look at the docs