blob: f5a1b4beef579bdbad3ba69c195a0d6fc56a9b9f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# == Schema Information
# Schema version: 20120919140404
#
# Table name: request_classifications
#
# id :integer not null, primary key
# user_id :integer
# info_request_event_id :integer
# created_at :datetime
# updated_at :datetime
#
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
|