-<% candidates = @election.candidates.sort.collect {|candidate| candidate.id} -%>
+<% candidates = @election.candidates.sort.collect {|candidate| candidate.id}-%>
+<% names = Hash.new -%>
+<% candidates.each do |candidate| -%>
+ <%names[candidate] = Candidate.find(candidate).name -%>
+<% end -%>
<table class="voterbox">
<tr>
<td> </td>
<% candidates.each do |candidate| -%>
- <th><%= candidate -%></th>
+ <th><%= names[candidate] -%></th>
<% end -%>
<% candidates.each do |winner| -%>
<tr>
- <th><%= winner %></th>
+ <th><%= names[winner] %></th>
<% candidates.each do |loser| -%>
<% if winner == loser -%>
<td> -- </td>
<% end -%>
<% end -%>
</tr>
-<%end -%>
\ No newline at end of file
+<% end -%>
+