aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/form_helper.rb
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2017-03-23 21:57:42 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2017-04-16 16:26:05 +0200
commita4c1282854795d1f0d7696ce1ccbabf94b3d9098 (patch)
tree5cdc43670a331fb1195f2f4ff929ff5dce42e554 /actionview/lib/action_view/helpers/form_helper.rb
parent6309b85100dd2b55c716ee4a4e9cbd3da2dc0617 (diff)
downloadrails-a4c1282854795d1f0d7696ce1ccbabf94b3d9098.tar.gz
rails-a4c1282854795d1f0d7696ce1ccbabf94b3d9098.tar.bz2
rails-a4c1282854795d1f0d7696ce1ccbabf94b3d9098.zip
Add `form_with_generates_remote_forms` config.
Allows users to not have remote forms by default, since there's more JS harness, e.g. bundling rails-ujs, otherwise. Also don't skip creating defaults file anymore. Sprockets isn't the only new config.
Diffstat (limited to 'actionview/lib/action_view/helpers/form_helper.rb')
-rw-r--r--actionview/lib/action_view/helpers/form_helper.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb
index bd035458a0..3eafe0028e 100644
--- a/actionview/lib/action_view/helpers/form_helper.rb
+++ b/actionview/lib/action_view/helpers/form_helper.rb
@@ -474,6 +474,8 @@ module ActionView
end
private :apply_form_for_options!
+ mattr_accessor(:form_with_generates_remote_forms) { true }
+
# Creates a form tag based on mixing URLs, scopes, or models.
#
# # Using just a URL:
@@ -1503,7 +1505,7 @@ module ActionView
end
private
- def html_options_for_form_with(url_for_options = nil, model = nil, html: {}, local: false,
+ def html_options_for_form_with(url_for_options = nil, model = nil, html: {}, local: !form_with_generates_remote_forms,
skip_enforcing_utf8: false, **options)
html_options = options.slice(:id, :class, :multipart, :method, :data).merge(html)
html_options[:method] ||= :patch if model.respond_to?(:persisted?) && model.persisted?