class QuickvoteController < ApplicationController
- layout 'hc'
+ layout 'main'
model :quick_voter
model :quick_vote
model :vote
#############################################################
def create
- breakpoint
if params[:quickvote]
@quickvote = QuickVote.new(params[:quickvote])
-
+
# store the candidate grabbed through ajax and stored in flash
@quickvote.candidatelist = flash[:candlist]
else
# record the ip address for posterity
- @voter.ipaddress = request.env["HTTP_X_FORWARDED_FOR"]
+ @voter.ipaddress = request.env["REMOTE_ADDR"]
@voter.save
- # toggle the confirmation bit
+ # save the time the vote was made for statistical use, it doesn't
+ #work here unless I use a method that will save it to the db
+ @voter.vote.time = Time.now
+
+ # toggle the confirmation bit
@voter.vote.confirm!
+
@voter.reload
render :action => 'thanks'
end