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:
David Roetzel 2011-03-04 16:36:12 +01:00
parent dd4f0c70bb
commit 7e8de74176
1 changed files with 1 additions and 1 deletions

View File

@ -26,7 +26,7 @@ module Cocoon
is_dynamic = f.object.new_record?
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