I'm using accepts_nested_attributes_for
for some nested resources and am using the _destroy
flag to remove an item on form save.
But instead of _destroy
actually running DELETE
on a r开发者_运维百科ecord, I'd like it to just update an active
boolean field to be false.
How can I do that?
Ehm.. So why do you use _destroy
? Just add active
checkbox istead of _destroy
<%= form_for @object do |f| %>
...
<%= f.fields_for @some_nested_object do |b| %>
...
<%= b.check_box :active %>
...
<% end %>
...
<% end %>
精彩评论