merged in licensing changes (we'll have to undo this eventually)
[selectricity-live] / app / models / ranking.rb
index f24f0f913dc8b33c7b0423e17701718f4c09943c..9a4719303fcce4672c1d3c5021d5eb16ae1bdd25 100644 (file)
@@ -1,4 +1,21 @@
+# Selectricity: Voting Machinery for the Masses
+# Copyright (C) 2007, 2008 Benjamin Mako Hill <mako@atdot.cc>
+# 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

Benjamin Mako Hill || Want to submit a patch?