优点 ruby gem 不会向添加了“user.passion.present”的用户添加积分。没有它也可以工作。我使用 Devise 和 Merit gems 设置了一切。除了这个,一切似乎都有效。
module Merit
class PointRules
include Merit::PointRulesMethods
def initialize
score 50, :on => 'user/registrations#create', model_name: 'User'
score 10, :on => 'user/registrations#update', model_name: 'User' do |user|
user.passion.present?
end
#
# score 15, :on => 'reviews#create', :to => [:reviewer, :reviewed]
#
# score 20, :on => [
# 'comments#create',
# 'photos#create'
# ]
score 20, on: 'lyrics#create', to: :user, description: 'Plus 20 points'
score (-20), on: 'lyrics#destroy', to: :user
end
end
end