From 3aef59cae2a4b4398b80c78d49361fa64e05c0fd Mon Sep 17 00:00:00 2001 From: Kyle Keesling Date: Tue, 29 Dec 2020 07:28:13 -0500 Subject: [PATCH] Update `form_with` and `form_for` documentation to reflect new non-remote defaults in 6.1 --- .../lib/action_view/helpers/form_helper.rb | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb index faa855dc6a..6c86db1a8c 100644 --- a/actionview/lib/action_view/helpers/form_helper.rb +++ b/actionview/lib/action_view/helpers/form_helper.rb @@ -186,8 +186,7 @@ module ActionView # get the authenticity token from the meta tag, so embedding is # unnecessary unless you support browsers without JavaScript. # * :remote - If set to true, will allow the Unobtrusive - # JavaScript drivers to control the submit behavior. By default this - # behavior is an ajax submit. + # JavaScript drivers to control the submit behavior. # * :enforce_utf8 - If set to false, a hidden input with name # utf8 is not output. # * :html - Optional HTML attributes for the form tag. @@ -323,10 +322,8 @@ module ActionView # remote: true # # in the options hash creates a form that will allow the unobtrusive JavaScript drivers to modify its - # behavior. The expected default behavior is an XMLHttpRequest in the background instead of the regular - # POST arrangement, but ultimately the behavior is the choice of the JavaScript driver implementor. - # Even though it's using JavaScript to serialize the form elements, the form submission will work just like - # a regular submission as viewed by the receiving side (all elements available in params). + # behavior. The form submission will work just like a regular submission as viewed by the receiving + # side (all elements available in params). # # Example: # @@ -536,11 +533,6 @@ module ActionView # accessible as params[:title] and params[:post][:title] # respectively. # - # By default +form_with+ attaches the data-remote attribute - # submitting the form via an XMLHTTPRequest in the background if an - # Unobtrusive JavaScript driver, like rails-ujs, is used. See the - # :local option for more. - # # For ease of comparison the examples above left out the submit button, # as well as the auto generated hidden fields that enable UTF-8 support # and adds an authenticity token needed for cross site request forgery @@ -612,8 +604,10 @@ module ActionView # This is helpful when fragment-caching the form. Remote forms # get the authenticity token from the meta tag, so embedding is # unnecessary unless you support browsers without JavaScript. - # * :local - By default form submits are remote and unobtrusive XHRs. - # Disable remote submits with local: true. + # * :local - By default form submits via typical HTTP requests. + # Enable remote and unobtrusive XHRs submits with local: false. + # Remote forms may be enabled by default by setting + # config.action_view.form_with_generates_remote_forms = true. # * :skip_enforcing_utf8 - If set to true, a hidden input with name # utf8 is not output. # * :builder - Override the object used to build the form.