X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/ffec26b00fc14b92f82137e1e3c62ce78c93ea24..15870a550ddd18192efc71c1355a238e7c7c53e8:/app/models/quick_vote.rb diff --git a/app/models/quick_vote.rb b/app/models/quick_vote.rb index bd39051..f9e1b83 100644 --- a/app/models/quick_vote.rb +++ b/app/models/quick_vote.rb @@ -1,8 +1,6 @@ class QuickVote < Election before_validation :build_candidate_names - after_validation :create_candidates validates_uniqueness_of :name - validates_presence_of :name attr_accessor :candidate_names attr_accessor :reviewed @@ -12,8 +10,6 @@ class QuickVote < Election self.startdate = Time.now self.active = 1 self.anonymous = 1 unless self.anonymous - self.enddate = read_attribute( :enddate ) || \ - Time.now + 30.days - 1.second end def validate @@ -63,8 +59,8 @@ class QuickVote < Election def build_candidate_names @candidate_names ||= [] - if @candidate_names.empty? and not candidates.empty? - @candidate_names = candidates.collect {|c| c.name} + if @candidate_names.empty? and not self.candidates.empty? + @candidate_names = self.candidates.collect {|c| c.name} end end