X-Git-Url: https://projects.mako.cc/source/selectricity/blobdiff_plain/9abed97635edbac7fb1a687298fff5c5434cdff4..005f5a86085c9cbcbc09c6655f3851a877462638:/app/models/ranking.rb diff --git a/app/models/ranking.rb b/app/models/ranking.rb index f24f0f9..9a47193 100644 --- a/app/models/ranking.rb +++ b/app/models/ranking.rb @@ -1,4 +1,21 @@ +# Selectricity: Voting Machinery for the Masses +# Copyright (C) 2007, 2008 Benjamin Mako Hill +# Copyright (C) 2007 Massachusetts Institute of Technology +# +# This program is free software. Please see the COPYING file for +# details. + class Ranking < ActiveRecord::Base belongs_to :candidate belongs_to :vote + acts_as_list :scope => :vote, :column => :rank + + def <=>(other) + self.rank <=> other.rank + end + + def to_s + self.rank.to_s + end + end