]> projects.mako.cc - selectricity-live/blobdiff - app/models/vote.rb
Added the ability to do ajax adding of candidates so there is no longer
[selectricity-live] / app / models / vote.rb
index 7678f5463900034de67c6ff2dff60c2d281a059c..014899d905ac9e07a185cd99f5abcae9db1d702f 100644 (file)
@@ -41,6 +41,11 @@ class Vote < ActiveRecord::Base
       self.rankings << ranking
     end
   end
+  
+  def destroy
+    self.destroy_rankings
+    super
+  end
 
   def destroy_rankings 
     rankings.each { |ranking| ranking.destroy }
@@ -71,4 +76,8 @@ class Vote < ActiveRecord::Base
     self.votes = rel_votes.collect { |vote| candidate_ids[ vote - 1 ] }
   end
 
+  def votestring
+    self.votes.join("")
+  end
+
 end

Benjamin Mako Hill || Want to submit a patch?