]> projects.mako.cc - selectricity/blob - app/models/voter.rb
updated top the the new version of attachment_fu plugin to work out some
[selectricity] / app / models / voter.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 Voter < ActiveRecord::Base
9   belongs_to :election
10   has_one :vote
11   
12   def reset_vote
13     self.vote.destroy
14     self.reload
15   end
16   
17   def destroy
18     vote.destroy if vote
19     super
20   end
21
22   def voted?
23     vote.confirmed == 1
24   end
25 end
26
27

Benjamin Mako Hill || Want to submit a patch?