+ def destroy_rankings
+ rankings.each { |ranking| ranking.destroy }
+ end
+
+ def confirm!
+ self.confirmed = 1
+ self.save
+
+ token.destroy and token.reload if token
+ self.token = Token.new
+ self.save
+ end
+
+ def confirm?
+ if confirm == 1
+ return true
+ else
+ return false
+ end
+ end
+
+ def votestring=(string="")
+ candidate_ids = voter.election.candidates.sort.collect \
+ { |candidate| candidate.id.to_i }
+
+ rel_votes = string.split("").collect { |vote| vote.to_i }
+
+ # covert relative orders to absolute candidate ids
+ self.votes = rel_votes.collect { |vote| candidate_ids[ vote - 1 ] }