diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-09-20 15:06:32 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-09-20 15:06:32 +0100 |
commit | add084ee6047d3cae72e3e445135b122d8ba2cc8 (patch) | |
tree | f9763b73753c44562d6572035ab71b4bae2957a0 /app/models/request_classification.rb | |
parent | 69103f5e83d538cd3aa9a3ea39cc5736aaec21e8 (diff) | |
parent | aebcdc082f277b3569d1300ebeda43c503d8aec5 (diff) |
Merge branch 'release/0.6.6'0.6.6
Conflicts:
locale/cs/app.po
locale/es/app.po
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 |