Render <form>
with form_tag
with form_with
This commit refactors our application’s View code by replacing our
notes#new
template’s call to form_tag
with a call to
form_with
.
The form_with
helper’s behavior is very similar to the form_tag
‘s.
In addition to generating a CSRF Protection-compliant <form>
element,
the form_with
helper will yield an instance of an
[ActionView::Helpers::FormBuilder
]. This commit doesn’t yet make use
of that instance, but its availability will enable future View layer
refactorings.
The form_with
helper is invoked with the local: true
option
to opt-out of submitting form asynchronously through Rails’ Unobtrusive
JavaScript (there will be more on that topic in future
commits).
When we run the test again after making this change, it still passes.