]> projects.mako.cc - selectricity-live/blobdiff - app/models/quick_vote.rb
Fix errors when viewing results as election creator before election close.
[selectricity-live] / app / models / quick_vote.rb
index de78813153025698796b8ce274f711072cf984e5..f9e1b83d8a02b81cf81c4c28fdc6323df7b48126 100644 (file)
@@ -1,6 +1,5 @@
 class QuickVote < Election
   before_validation :build_candidate_names
 class QuickVote < Election
   before_validation :build_candidate_names
-  after_validation :create_candidates
   validates_uniqueness_of :name
 
   attr_accessor :candidate_names
   validates_uniqueness_of :name
 
   attr_accessor :candidate_names
@@ -60,8 +59,8 @@ class QuickVote < Election
 
   def build_candidate_names
     @candidate_names ||= []
 
   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
 
     end
   end
 

Benjamin Mako Hill || Want to submit a patch?