@@ -757,8 +757,7 @@ def apply_form_for_options!(record, object, options) # :nodoc:
757
757
# form_with(**options.merge(builder: LabellingFormBuilder), &block)
758
758
# end
759
759
def form_with ( model : nil , scope : nil , url : nil , format : nil , **options , &block )
760
- options [ :allow_method_names_outside_object ] = true
761
- options [ :skip_default_ids ] = !form_with_generates_ids
760
+ options = { allow_method_names_outside_object : true , skip_default_ids : !form_with_generates_ids } . merge! ( options )
762
761
763
762
if model
764
763
if url != false
@@ -1575,35 +1574,11 @@ def _object_for_form_builder(object) # :nodoc:
1575
1574
private
1576
1575
def html_options_for_form_with ( url_for_options = nil , model = nil , html : { } , local : !form_with_generates_remote_forms ,
1577
1576
skip_enforcing_utf8 : nil , **options )
1578
- html_options = options . slice ( :id , :class , :multipart , :method , :data ) . merge ( html )
1577
+ html_options = options . slice ( :id , :class , :multipart , :method , :data , :authenticity_token ) . merge! ( html )
1578
+ html_options [ :remote ] = !local
1579
1579
html_options [ :method ] ||= :patch if model . respond_to? ( :persisted? ) && model . persisted?
1580
1580
html_options [ :enforce_utf8 ] = !skip_enforcing_utf8 unless skip_enforcing_utf8 . nil?
1581
-
1582
- html_options [ :enctype ] = "multipart/form-data" if html_options . delete ( :multipart )
1583
-
1584
- # The following URL is unescaped, this is just a hash of options, and it is the
1585
- # responsibility of the caller to escape all the values.
1586
- if url_for_options == false || html_options [ :action ] == false
1587
- html_options . delete ( :action )
1588
- else
1589
- html_options [ :action ] = url_for ( url_for_options || { } )
1590
- end
1591
- html_options [ :"accept-charset" ] = "UTF-8"
1592
- html_options [ :"data-remote" ] = true unless local
1593
-
1594
- html_options [ :authenticity_token ] = options . delete ( :authenticity_token )
1595
-
1596
- if !local && html_options [ :authenticity_token ] . blank?
1597
- html_options [ :authenticity_token ] = embed_authenticity_token_in_remote_forms
1598
- end
1599
-
1600
- if html_options [ :authenticity_token ] == true
1601
- # Include the default authenticity_token, which is only generated when it's set to nil,
1602
- # but we needed the true value to override the default of no authenticity_token on data-remote.
1603
- html_options [ :authenticity_token ] = nil
1604
- end
1605
-
1606
- html_options . stringify_keys!
1581
+ html_options_for_form ( url_for_options . nil? ? { } : url_for_options , html_options )
1607
1582
end
1608
1583
1609
1584
def instantiate_builder ( record_name , record_object , options )
0 commit comments