]> projects.mako.cc - selectricity-live/blobdiff - app/models/election.rb
Added initial support fo QuickVotes. There is support for the creation
[selectricity-live] / app / models / election.rb
index 69038e473946ceddd9a2a23e5fe7dae7571ba31f..ba466b4b55928dac2f5291e0513d77b684a8c08d 100644 (file)
@@ -21,5 +21,23 @@ class Election < ActiveRecord::Base
     end
     super
   end
-  
+
+  def start_blockers
+    reasons = []
+    
+    if self.candidates.length <= 1
+      reasons << "You must have at least two candidates."
+    end
+    
+    if self.voters.length <= 1
+      reasons << "You must have at least two voters."
+    end
+
+    reasons
+  end
+
+  def activate!
+    self.active = 1
+  end
+
 end

Benjamin Mako Hill || Want to submit a patch?