]> projects.mako.cc - selectricity/blob - app/models/candidate.rb
Add links to create new election/quick vote on the account summary screen.
[selectricity] / app / models / candidate.rb
1 # Selectricity: Voting Machinery for the Masses
2 # Copyright (C) 2007, 2008 Benjamin Mako Hill <mako@atdot.cc>
3 # Copyright (C) 2007 Massachusetts Institute of Technology
4 #
5 # This program is free software. Please see the COPYING file for
6 # details.
7
8 class Candidate < ActiveRecord::Base
9   belongs_to :election
10   has_one :picture
11   validates_presence_of :name
12
13   # validate uniqueness of a name *within a given election*
14
15   def <=>(other)
16     self.name <=> other.name 
17   end
18   
19   def to_s
20     name
21   end
22
23 end
24

Benjamin Mako Hill || Want to submit a patch?