]> projects.mako.cc - selectricity-live/blob - app/models/voter.rb
Created a partial to DRY the aja voting method. Modified the voter class to
[selectricity-live] / app / models / voter.rb
1 class Voter < ActiveRecord::Base
2   belongs_to :election
3   has_one :vote
4   
5   def reset_vote
6     self.vote.destroy
7     self.reload
8   end
9   
10   def destroy
11     vote.destroy if vote
12     super
13   end
14
15   def voted?
16     vote.confirmed == 1
17   end
18 end
19
20

Benjamin Mako Hill || Want to submit a patch?