This repository has been archived by the owner on Nov 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 123
Find with Reputation
kn edited this page Oct 15, 2012
·
3 revisions
ActiveRecord Reputation System allows you to find records with reputation values.
You can find records with reputation values by:
ActiveRecord::Base.find_with_reputation(reputation_name, find_scope, options)
For example:
User.find_with_reputation(:karma, :all, {:select => "id", :conditions => ["karma > ?", 3], :order => "karma"})
Then you can access reputation values as follow:
@users[0].karma
You can find records with normalized reputation values by:
ActiveRecord::Base.find_with_normalized_reputation(reputation_name, find_options)
For example:
User.find_with_normalized_reputation(:karma, :all, {:select => "id", :conditions => ["karma > ?", 0.5], :order => "karma"})
Then you can access normalized reputation values as follow:
@users[0].normalized_karma
You can count records with reputation values by:
ActiveRecord::Base.count_with_reputation(reputation_name, find_options)
You can get a SQL statement as a string by:
ActiveRecord::Base.find_with_reputation_sql(reputation_name, find_options)