繁体   English   中英

如何使用acts_as_votable gem 让所有被投票的帖子成为当前用户

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM