projects
/
selectricity
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Major update of Selectricity to work with Rails 2.2.2 from 1.2!
[selectricity]
/
app
/
models
/
vote.rb
diff --git
a/app/models/vote.rb
b/app/models/vote.rb
index bef35020a45b1a7d37ca25fdd86dec73259f8ab5..d3010dfeac754978883be4d75a9cc755ee5dca90 100644
(file)
--- a/
app/models/vote.rb
+++ b/
app/models/vote.rb
@@
-39,7
+39,7
@@
class Vote < ActiveRecord::Base
if rankings.empty?
@votes = Array.new
else
if rankings.empty?
@votes = Array.new
else
- @votes = rankings.sort.collect { |ranking| ranking.candidate.id }
+ @votes =
self.
rankings.sort.collect { |ranking| ranking.candidate.id }
end
end
end
end
@@
-51,6
+51,9
@@
class Vote < ActiveRecord::Base
end
def save_rankings
end
def save_rankings
+ self.votes # i need to initalize this before destroying rankings
+ # or else the ranks themselves show up as nil
+
destroy_rankings
self.votes.each_with_index do |candidate_id, index|
ranking = Ranking.new
destroy_rankings
self.votes.each_with_index do |candidate_id, index|
ranking = Ranking.new
Benjamin Mako Hill
||
Want to submit a patch?