X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/fc0a6a8d7ea15bcdb27ebdd58721401c7045c6e0..c405443c19a18c645aacc16848502f5b91461feb:/app/controllers/quickvote_controller.rb diff --git a/app/controllers/quickvote_controller.rb b/app/controllers/quickvote_controller.rb old mode 100755 new mode 100644 index 5e29a10..d842f63 --- a/app/controllers/quickvote_controller.rb +++ b/app/controllers/quickvote_controller.rb @@ -1,5 +1,5 @@ class QuickvoteController < ApplicationController - layout 'hc' + layout 'main' model :quick_voter model :quick_vote model :vote @@ -12,7 +12,7 @@ class QuickvoteController < ApplicationController def create if params[:quickvote] @quickvote = QuickVote.new(params[:quickvote]) - + # store the candidate grabbed through ajax and stored in flash @quickvote.candidatelist = flash[:candlist] @@ -66,7 +66,7 @@ class QuickvoteController < ApplicationController @voter = nil end - # if the voter does not exist or as has been destroyed, lets + # if the voter does not exist or has has been destroyed, lets # create a new one unless @voter # create a new voter and populate it @@ -105,11 +105,16 @@ class QuickvoteController < ApplicationController 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