Add posts test
This commit is contained in:
parent
0df07c478a
commit
76229c8cc5
17 changed files with 278 additions and 0 deletions
27
app/views/posts/_form.html.erb
Normal file
27
app/views/posts/_form.html.erb
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<%= form_with(model: post) do |form| %>
|
||||
<% if post.errors.any? %>
|
||||
<div style="color: red">
|
||||
<h2><%= pluralize(post.errors.count, "error") %> prohibited this post from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% post.errors.each do |error| %>
|
||||
<li><%= error.full_message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<%= form.label :title, style: "display: block" %>
|
||||
<%= form.text_field :title %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :body, style: "display: block" %>
|
||||
<%= form.textarea :body %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
Loading…
Add table
Add a link
Reference in a new issue