I have User and Community models.
Community model will be liked by a user by this command
if current_user.voted_up_on? @community
current_user.dislikes @community
else
current_user.likes @community
end
and I’m now trying to fetch all the users who liked @community.
I’m trying to do it with this. But it won’t return correct users.
How can I fix this?
@users = User.where(:id => @community.likes.map(&:voter_id)).order("last_active_at DESC").limit(10)
I’m using the gem called ‘acts_as_votable’ for this
https://github.com/ryanto/acts_as_votable
That would return AR::Relation