aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-12-18 12:14:24 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2016-12-18 20:18:47 +0100
commitb64467ecad9cfa450ec172f59d656c3baced57e6 (patch)
tree06fd9d3708cf34cc8d1df05081b215593cf3cd6f /actionview
parent4c5f1bc9d45eb721dfd942cbd1c4e837fdd01038 (diff)
downloadrails-b64467ecad9cfa450ec172f59d656c3baced57e6.tar.gz
rails-b64467ecad9cfa450ec172f59d656c3baced57e6.tar.bz2
rails-b64467ecad9cfa450ec172f59d656c3baced57e6.zip
Make attributes output in html opt-in.
By using `except` any option provided to `form_with` would become an html attribute unless explicitly opted out. This proved annoying when adding new internal keys in the options hash and seeing them pop up in the html output. Prevent this by inverting the `except` to `slice` out the keys we want to allow becoming html attributes, like id and class.
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/helpers/form_helper.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb
index 6c632b8e75..a94a28306a 100644
--- a/actionview/lib/action_view/helpers/form_helper.rb
+++ b/actionview/lib/action_view/helpers/form_helper.rb
@@ -1492,7 +1492,7 @@ module ActionView
private
def html_options_for_form_with(url_for_options = nil, model = nil, html: {}, local: false,
skip_enforcing_utf8: false, **options)
- html_options = options.except(:index, :include_id, :skip_default_ids, :builder).merge(html)
+ html_options = options.slice(:id, :class, :multipart, :method, :data).merge(html)
html_options[:method] ||= :patch if model.respond_to?(:persisted?) && model.persisted?
html_options[:enforce_utf8] = !skip_enforcing_utf8