X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/75091532075247ae9c47164ea883f4fe803eddf4..3096416bbb8fdc92d7619aecc8237a57532d9066:/app/models/vote.rb diff --git a/app/models/vote.rb b/app/models/vote.rb index 7678f54..014899d 100644 --- a/app/models/vote.rb +++ b/app/models/vote.rb @@ -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