0

优点 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
4

1 回答 1

0

您是否将实例变量添加到update覆盖的操作中?请参阅 wiki 页面:https ://github.com/tute/merit/wiki/How-to-grant-badges-on-user-registration-using-Devise 。

于 2015-03-29T21:47:31.583 回答