# store the candidate grabbed through ajax and stored in flash
@quickvote.candidatelist = flash[:candlist]
# store the candidate grabbed through ajax and stored in flash
@quickvote.candidatelist = flash[:candlist]
# create a new one
unless @voter
# create a new voter and populate it
@voter = QuickVoter.new
@voter.election = QuickVote.find_all( [ "name = ?", params[:votename] ] )[0]
@voter.session_id = session.session_id
# create a new one
unless @voter
# create a new voter and populate it
@voter = QuickVoter.new
@voter.election = QuickVote.find_all( [ "name = ?", params[:votename] ] )[0]
@voter.session_id = session.session_id
# find out who the voter is for this election
@voter = QuickVoter.find_all(["session_id = ? and election_id = ?",
# find out who the voter is for this election
@voter = QuickVoter.find_all(["session_id = ? and election_id = ?",
if not @voter
# we have not seen this voter before. something is wrong, try
# again
redirect_to quickvote_url( :votename => params[:votename] )
if not @voter
# we have not seen this voter before. something is wrong, try
# again
redirect_to quickvote_url( :votename => params[:votename] )
# this person has already voted, we try again
flash[:notice] = "You have already voted!"
redirect_to quickvote_url( :votename => params[:votename] )
else
# record the ip address for posterity
# this person has already voted, we try again
flash[:notice] = "You have already voted!"
redirect_to quickvote_url( :votename => params[:votename] )
else
# record the ip address for posterity