Complete the code to start a form using the form_with helper for a new @post object.
<%= form_with model: [1] do |form| %>
<!-- form fields here -->
<% end %>The form_with helper uses the model: option with an instance variable like @post to build the form for that object.
Complete the code to create a text field for the :title attribute inside the form builder.
<%= form_with model: @post do |form| %>
<%= form.[1] :title %>
<% end %>input which is not a form builder method.text_area which creates a multi-line box.label which only creates a label.The text_field method creates a single-line text input for the specified attribute.
Fix the error in the form_with call to submit the form with a custom URL '/posts/create'.
<%= form_with url: [1] do |form| %> <%= form.submit 'Save' %> <% end %>
The URL must be a string wrapped in quotes to be valid Ruby syntax.
Fill both blanks to create a form that submits with method PATCH to update @article.
<%= form_with model: [1], method: [2] do |form| %> <%= form.submit %> <% end %>
The model: option uses the instance variable @article. The method: option requires a symbol :patch to specify the HTTP method.
Fill all three blanks to create a form with a text field for :name, a label, and a submit button with text 'Send'.
<%= form_with model: @user do |form| %> <%= form.[1] :name %> <%= form.[2] :name %> <%= form.[3] 'Send' %> <% end %>
The text_field creates the input box, label creates the label for the input, and submit creates the submit button with the given text.
