Back to Course

Practice · Reading the Source · Card 5

What's missing from this hand-written form?

A developer reaches for raw HTML instead of form_with. The form posts, but the update doesn't happen. Three pieces are missing.

The form

For an existing Post (id: 42). The intent is "update the title and body."

<form action="/posts/42" method="post">
  <label>Title</label>
  <input type="text" name="title">

  <label>Body</label>
  <textarea name="body"></textarea>

  <input type="submit" value="Update Post">
</form>

The question

Which set of additions would form_with model: @post have inserted into this form?

Take a moment. Pick the best answer. Wrong picks reveal why they're wrong, which is half the point.