Create model for candidates with name and description

This commit is contained in:
ricola 2025-04-06 17:04:31 -06:00
parent f7f1807839
commit d6500e013d
6 changed files with 64 additions and 5 deletions

View file

@ -1,3 +1,28 @@
<h1><%= @vote.title %></h1>
<p><%= @vote.description %></p>
<h2>Candidates</h2>
<ul>
<% @vote.candidates.each do |candidate| %>
<li>
<p><%= candidate.name %></p>
<p><%= candidate.description %></p>
</li>
<% end %>
</ul>
<h2>New candidate</h2>
<form action="/votes/<%= @vote.secure_id %>/candidates" method="post">
<p>
<label for="name">Name</label>
<input type="text" name="name">
</p>
<p>
<label for="description">Description</label>
<input type="text" name="description">
</p>
<button type="submit">Add new candidate</button>
</form>