Create model for votes with secure_id, title, and description
This commit is contained in:
parent
5e8cda6fc0
commit
f7f1807839
9 changed files with 106 additions and 10 deletions
|
|
@ -1,5 +1,19 @@
|
|||
<h1>Home</h1>
|
||||
|
||||
<p>Hello, <%= current_user.email %>.</p>
|
||||
<form action="/logout" method="POST">
|
||||
<input type="submit" value="Log out" />
|
||||
|
||||
<h2>Votes</h2>
|
||||
|
||||
<% @votes.each do |vote| %>
|
||||
<li>
|
||||
<a href="/votes/<%= vote.secure_id %>"><%= vote.title %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<form action="/votes/new" method="get">
|
||||
<button type="submit">Create new vote</button>
|
||||
</form>
|
||||
|
||||
<form action="/logout" method="post">
|
||||
<button type="submit">Log out</button>
|
||||
</form>
|
||||
|
|
|
|||
13
views/votes_new.erb
Normal file
13
views/votes_new.erb
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<h1>New vote</h1>
|
||||
|
||||
<form action="/votes" method="post">
|
||||
<p>
|
||||
<label for="title">Title</label>
|
||||
<input type="text" name="title">
|
||||
</p>
|
||||
<p>
|
||||
<label for="description">Description</label>
|
||||
<input type="text" name="description">
|
||||
</p>
|
||||
<button type="submit">Create new vote</button>
|
||||
</form>
|
||||
3
views/votes_show.erb
Normal file
3
views/votes_show.erb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<h1><%= @vote.title %></h1>
|
||||
|
||||
<p><%= @vote.description %></p>
|
||||
Loading…
Add table
Add a link
Reference in a new issue