1

我使用thumbs_up gem 为我的 Rails 应用程序(它是一个问题/答案应用程序,如 Stack Overflow)创建了一个投票系统。

问题是我希望用户(提交答案和问题)的业力基于他所写的答案和问题。

has_karma :questions, :as => :submitter, :weight => [ 1, 0.5 ]

上面这行,写在用户模型中,根据他提交的问题计算他的业力。想根据答案和问题来计算业力。

那可行吗?

4

1 回答 1

0

I discovered that we can do this :

has_karma :questions, :as => :user, :weight => [ 1, 1]
 has_karma :answers, :as => :user, :weight => [ 1, 1]

The karma will then be calculated based on both questions and answers. That's great :)

于 2014-02-15T20:01:36.260 回答