Sha256: 1998e24a2f3b3496899f171bebf754a55b7b878280e5646c3b08f4a2c513a55c

Contents?: true

Size: 759 Bytes

Versions: 2

Compression:

Stored size: 759 Bytes

Contents

# Points are a simple integer value which are given to "meritable" resources
# according to rules in +app/models/merit/point_rules.rb+. They are given on
# actions-triggered.

module Merit
  class PointRules
    include Merit::PointRulesMethods

    def initialize
      # Thanks for voting point
      score 1, :on => 'comments#vote'

      # All user's comments earn points
      score 2, :to => :user_comments, :on => 'comments#vote'

      # Points to voted user
      score 5, :to => :user, :on => 'comments#vote'

      score 20, :on => [
        'comments#create',
        'registrations#update'
      ] do |object|
        if object.class == Comment
          object.name.length > 4
        else
          true
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
merit-1.5.0 test/dummy/app/models/merit/point_rules.rb
merit-1.4.0 test/dummy/app/models/merit/point_rules.rb