Use hidden_field_tag instead of hidden_field.
This works around problems with accepts_nested_attributes_for :reject_if => :all_blank. hidden_field injects a (String!) value of "false" into the form, effectively disabling the all_blank check.
This commit is contained in:
parent
dd4f0c70bb
commit
7e8de74176
|
@ -26,7 +26,7 @@ module Cocoon
|
||||||
|
|
||||||
is_dynamic = f.object.new_record?
|
is_dynamic = f.object.new_record?
|
||||||
html_options[:class] = [html_options[:class], "remove_fields #{is_dynamic ? 'dynamic' : 'existing'}"].compact.join(' ')
|
html_options[:class] = [html_options[:class], "remove_fields #{is_dynamic ? 'dynamic' : 'existing'}"].compact.join(' ')
|
||||||
f.hidden_field(:_destroy) + link_to(name, '#', html_options)
|
hidden_field_tag("#{f.object_name}[_destroy]") + link_to(name, '#', html_options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue