1 class Election < ActiveRecord::Base
6 validates_presence_of :name, :description
11 read_attribute( :startdate ) || DateTime.now
15 read_attribute( :enddate ) || DateTime.now + 14
19 self.candidates.each do |candidate|
28 if self.candidates.length <= 1
29 reasons << "You must have at least two candidates."
32 if self.voters.length <= 1
33 reasons << "You must have at least two voters."