0

I am working on CMS and I need to implement a reputation system which enable these features

  1. Badges
  2. Points
  3. Ranks

I found this gem from twitter, activerecord-reputation-system but I'm not pretty sure how to use this on my own application. Appreciate if someone can help me out. Here is my scenario. (Example only)

class Manager < ActiveRecord::Base
end

class Employee < ActiveRecord::Base
has_many :jobs
end

class Category < ActiveRecord::Base
# has a name and points field 
# example: Cat A, 5 
# example: Cat B, 10
end

class Job < ActiveRecord::Base
belongs_to :employee
belongs_to :category
end

So the models are Managers, Employees, Jobs, Categories. Basically Manager create Job entries and assign Employee and Category for each Job entry.

What I need to do is, everytime when Manager create a Job entry, assign points to Employee based on the Job Category they belongs to, and calculate Rank or assign badge as per the points they have earned. (Using Category.points)

Is this doable from above Gem? if so, how do I use has_reputation in my models.

Thanks

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
randika
  • 1,519
  • 3
  • 18
  • 39

3 Answers3

2

activerecord-reputation-system does not include badges.

One popular gem that meets your requirements (badges, points and rankings) is merit.

Benjamin Crouzier
  • 40,265
  • 44
  • 171
  • 236
1

Check out R. Bates railscast on this gem...

http://railscasts.com/episodes/364-active-record-reputation-system

..that should get you moving the right direction.

Mark Locklear
  • 5,044
  • 1
  • 51
  • 81
  • Thanks - I saw this one, but all these examples are for, `User` model involves for up/down voting. In my case a Manager model create the job entries and I should assign the points on this level. – randika Jan 28 '13 at 15:48
  • Many you could use the same logic that is involved in the User model, just apply it to Manager, Employee, etc. Rather than assigning the points to an up/down vote, you just hard code the logic based on whatever trigger you want. – Mark Locklear Jan 29 '13 at 13:23
  • I added this to `Category` model `has_reputation :category_points, :source => :employee` and inside the Job model I have this `after_save` method `self.category.increase_evaluation(:category_points, self.category.score.to_i, self.employee)` - But not sure what would come under `Employee` model yet. – randika Jan 29 '13 at 17:24
0

Have a look at my clone of Paths of Glory, a plugin to manage user achievements/badges.

An example page generated by this plugin can be seen here (click on the Badges tab.)

There are several other forks of this plugin and is worth exploring the clone tree.

HTH and good luck.

Nazar
  • 1,499
  • 12
  • 24
  • 1
    Thanks, but it seems out dated. I still need to try this with activerecord-reputation-system gem. – randika Jan 28 '13 at 15:50