Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用带有 Rails 3.1.0 的 Active Record 信誉系统。我有一个模型,用户可以投票赞成或反对。如何确定特定模型实例被投票了多少次?我想说“x of y users up-voted this item”。我怎么得到你?
如果我有一个具有声誉的模型并且我有一个模型实例 model_instance,那么看起来我可以通过以下方式获得总票数:
model_instance.evaluations.count