Regarding form_with
recommended by Rails 5.1, this time I will briefly explain one of the options local: true
.
<%= form_with(model: @user, local: true) do |f| %>
https://railsdoc.com/page/form_with
There is a list of options in this Rails document, but according to the explanation here, "remote transmission is disabled (default is false)".
In other words, if local: true
is not entered, asynchronous communication (communication by Ajax) will be performed.
If you enter local: true
, asynchronous communication will be canceled and the form can be submitted as HTML.
Regarding Ajax, the following article was very easy to understand. https://pikawaka.com/word/ajax
If you have any supplements, please comment!