X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/2ba40f97b78f529984ff26c7c7d61c91d213e7b0..fd484b33a3920e0031007c5c2f1dec61913cbab5:/app/models/election.rb diff --git a/app/models/election.rb b/app/models/election.rb index 69038e4..ba466b4 100644 --- a/app/models/election.rb +++ b/app/models/election.rb @@ -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