Variety of improvements and additions:
[selectricity-live] / app / controllers / voter_controller.rb
1 class VoterController < ApplicationController
2   model :voter
3   model :vote
4   model :election
5
6   def index
7     password = params[:id]
8     @voter = Voter.find_all( [ "password = ?", password ] )[0]
9   end
10   
11   def review
12     password = params[:id]
13     @voter = Voter.find_all( [ "password = ?", password ] )[0]
14     
15     # destroy the old vote if that's what we need to do
16     @voter.vote.destroy if @voter.vote 
17     @voter.reload
18
19     @voter.vote = Vote.new
20     @voter.vote.votestring = params[:vote][:votestring] 
21     @voter.vote.save
22     render_text "success"
23   end
24
25 end

Benjamin Mako Hill || Want to submit a patch?