]> projects.mako.cc - selectricity/blobdiff - app/controllers/quickvote_controller.rb
fixed the string modification function and added support for a titlecase method
[selectricity] / app / controllers / quickvote_controller.rb
index c3510f60bfb34a8b9775f04afe1ef310ac2b8263..c16755a0a8636da9d8598f2bc65edc9afa004a6e 100644 (file)
@@ -1,5 +1,5 @@
 class QuickvoteController < ApplicationController
-  layout 'vb'
+  layout 'hc'
   model :quick_voter
   model :vote
   model :election
@@ -11,7 +11,7 @@ class QuickvoteController < ApplicationController
                                   session.session_id, @election.id])[0]
     unless @voter 
       @voter = QuickVoter.new
-      @voter.election = Election.find_all( [ "name = ?", params[:votename] ] )[0]
+      @voter.election = QuickVote.find_all( [ "name = ?", params[:votename] ] )[0]
     end
   end
 
@@ -42,6 +42,7 @@ class QuickvoteController < ApplicationController
       @voter = QuickVoter.new()
       @voter.election = election
       @voter.session_id = session.session_id
+      @voter.ipaddress = request.env["REMOTE_ADDR"]
       @voter.save
       @voter.reload
         
@@ -53,7 +54,7 @@ class QuickvoteController < ApplicationController
   end
   
   def results
-    @election = Election.find_all( ["name = ?", params[:votename]] )[0]
+    @election = QuickVote.find_all( ["name = ?", params[:votename]] )[0]
 
     preference_tally = []
     plurality_tally = []

Benjamin Mako Hill || Want to submit a patch?