method
html_options_for_form_with
v5.1.7 -
Show latest stable
-
0 notes -
Class: ActionView::Helpers::FormHelper
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
html_options_for_form_with(url_for_options = nil, model = nil, html: {}, local: !form_with_generates_remote_forms, skip_enforcing_utf8: false, **options)
private
Hide source
# File actionview/lib/action_view/helpers/form_helper.rb, line 1538 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? html_options[:enforce_utf8] = !skip_enforcing_utf8 html_options[:enctype] = "multipart/form-data" if html_options.delete(:multipart) # The following URL is unescaped, this is just a hash of options, and it is the # responsibility of the caller to escape all the values. html_options[:action] = url_for(url_for_options || {}) html_options[:"accept-charset"] = "UTF-8" html_options[:"data-remote"] = true unless local html_options[:authenticity_token] = options.delete(:authenticity_token) if !local && html_options[:authenticity_token].blank? html_options[:authenticity_token] = embed_authenticity_token_in_remote_forms end if html_options[:authenticity_token] == true # Include the default authenticity_token, which is only generated when it's set to nil, # but we needed the true value to override the default of no authenticity_token on data-remote. html_options[:authenticity_token] = nil end html_options.stringify_keys! end