modified show for candidates, can now show name, slogan, and voters(number of voters in progress)

parent 1eaf9d2d
...@@ -2,7 +2,7 @@ class PositionsController < ApplicationController ...@@ -2,7 +2,7 @@ class PositionsController < ApplicationController
before_action :authenticate_user! before_action :authenticate_user!
def show def show
@position = Position.find(params[:id]) @position = Position.find(params[:id])
@candidates = @candidate.positions @candidates = @position.candidates
render "positions/show.html.erb" render "positions/show.html.erb"
end end
......
<h1>Position: <%= @position.name %></h1> <h2>Candidate: <%= @candidate.first_name %> <%= @candidate.last_name %> </h2>
<h2>Candidates:</h2> <h3><%= @candidate.slogan %></h3>
<ul> <ul>
<% @candidates.each do |c| %> <li>Votes: <% @votes_male.size + @votes_female.size %></li>
<li><%= link_to "#{c.first_name}"+" #{c.last_name}", admin_candidate_path(c.id) %></li> <li>Male Voters: <% @votes_male.size %></li>
<% end %> <li>Female Voters: <% @votes_female.size %></li>
</ul> </ul>
<%= link_to "Back to Candidates", admin_candidates_path %>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment