[英]how to get all the posts upvoted be current user using acts_as_votable gem
我想顯示用戶投票的所有帖子,我該怎么做。
假設你有這樣的模型
class Post < ApplicationRecord
acts_as_votable
end
class User < ApplicationRecord
acts_as_voter
end
獲取某個用戶(例如current_user
)的所有贊成的帖子
current_user.get_up_voted(Post)
另請查看文檔
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.