aboutsummaryrefslogblamecommitdiffstats
path: root/guides/code/getting_started/app/views/posts/_form.html.erb
blob: f2f83585e1142a2e0994b184c2de167d65900989 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
                            
                            
                              







                                                                
           
     
                             

                              
 
     
                            

                            
 


                   
         
 
<%= form_for @post do |f| %>
  <% if @post.errors.any? %>
  <div id="error_explanation">
    <h2><%= pluralize(@post.errors.count, "error") %> prohibited
      this post from being saved:</h2>
    <ul>
    <% @post.errors.full_messages.each do |msg| %>
      <li><%= msg %></li>
    <% end %>
    </ul>
  </div>
  <% end %>
  <p>
    <%= f.label :title %><br>
    <%= f.text_field :title %>
  </p>

  <p>
    <%= f.label :text %><br>
    <%= f.text_area :text %>
  </p>

  <p>
    <%= f.submit %>
  </p>
<% end %>