diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-09-11 09:49:37 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-09-11 09:49:37 +0100 |
commit | c6a06ce6cf09946f661d870dfaed85dfc0d6efd0 (patch) | |
tree | f2c7d8686e9b42149a0e1b667f06fa1a1eba092f /app/models/request_classification.rb | |
parent | 527f577fcec629e3a39072a144ef96d31b193f8b (diff) | |
parent | 927e97c57725a424eb4fb25f3f4a1a758e9b7728 (diff) |
Merge branch 'feature/faster-request-game' into develop
Diffstat (limited to 'app/models/request_classification.rb')
-rw-r--r-- | app/models/request_classification.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/models/request_classification.rb b/app/models/request_classification.rb new file mode 100644 index 000000000..678b6cd16 --- /dev/null +++ b/app/models/request_classification.rb @@ -0,0 +1,16 @@ +class RequestClassification < ActiveRecord::Base + belongs_to :user + + # return classification instances representing the top n + # users, with a 'cnt' attribute representing the number + # of classifications the user has made. + def RequestClassification.league_table(size, conditions=[]) + find(:all, :select => 'user_id, count(*) as cnt', + :conditions => conditions, + :group => 'user_id', + :order => 'cnt desc', + :limit => size, + :include => :user) + end + +end
\ No newline at end of file |