]> projects.mako.cc - selectricity-live/blobdiff - app/models/candidate.rb
Merge branch 'master' of git://gitorious.org/~ruinar/selectricity/ruinar-selectricity
[selectricity-live] / app / models / candidate.rb
index 44a4d63ff4660f6558d8146bf1c6801d3627e3ba..6048562988abff1aa552295eb10211389324051c 100644 (file)
@@ -1,3 +1,24 @@
+# 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 Candidate < ActiveRecord::Base
   belongs_to :election
+  has_one :picture
+  validates_presence_of :name
+
+  # validate uniqueness of a name *within a given election*
+
+  def <=>(other)
+    self.name <=> other.name 
+  end
+  
+  def to_s
+    name
+  end
+
 end
+

Benjamin Mako Hill || Want to submit a patch?