]> projects.mako.cc - selectricity-live/blobdiff - app/models/quick_vote.rb
Modified QuickVote table to work by object type and not by the weird
[selectricity-live] / app / models / quick_vote.rb
old mode 100644 (file)
new mode 100755 (executable)
index d6ab55b..8d4e6e8
@@ -16,17 +16,13 @@ class QuickVote < Election
   
   def initialize(params={})
     super
-    self.enddate =  DateTime.now + 30
+    self.enddate =  Time.now + 30.days
     self.active = 1
     self.anonymous = 1
   end
 
-  def candidatelist=(candstring='')
-    @raw_candidates = candstring.split(';').collect {|cand| cand.strip }
-  end
-
-  def candidatelist
-    @raw_candidates.join("; ")
+  def candidatelist=(candlist)
+    @raw_candidates = candlist
   end
 
   def name
@@ -34,17 +30,12 @@ class QuickVote < Election
   end
 
   def reviewed?
-    if reviewed.to_i == 1
-      return true
-    else
-      false
-    end
+    reviewed.to_i == 1
   end
 
   def create_candidates
     @raw_candidates.each do |name|
       candidate = Candidate.new({:name => name})
-      candidate.save
       self.candidates << candidate
     end
   end

Benjamin Mako Hill || Want to submit a patch?