Source

demo_app / app / views / microposts / _form.html.erb

Full commit
<%= form_for(@micropost) do |f| %>
  <% if @micropost.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@micropost.errors.count, "error") %> prohibited this micropost from being saved:</h2>

      <ul>
      <% @micropost.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :content %><br />
    <%= f.text_field :content %>
  </div>
  <div class="field">
    <%= f.label :user_id %><br />
    <%= f.text_field :user_id %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>