Skip to content
This repository has been archived by the owner on Nov 13, 2021. It is now read-only.

Find with Reputation

kn edited this page Oct 15, 2012 · 3 revisions

ActiveRecord Reputation System allows you to find records with reputation values.

Find with reputation value

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

Find with normalized reputation value

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

Count with reputation value

You can count records with reputation values by:

ActiveRecord::Base.count_with_reputation(reputation_name, find_options)

Get SQL statment

You can get a SQL statement as a string by:

ActiveRecord::Base.find_with_reputation_sql(reputation_name, find_options)