I know that you can have:
accepts_nested_attributes_for :foo, :reject_if => proc { |a| a[:bar].blank? }
Is there a way to instead say something like
accepts_nested_attributes_for :foo, :reject_if => blah[:bar].blank? and flah[:bar].blank?
or
accepts_nested_attributes_for :foo, :reject_if => all fields except record_date.blank?
Thanks
Inspired by this : https://rails.lighthouseapp.com/projects/8994/tickets/2501-any_blank-and-all_blank-options-for-accepts_nested_attributes_for-reject_if
This worked fine for me:
You can replace
['foo', 'bar', 'baz'].include?(k)
byk == 'foo'
if there's only one exception but the first syntax makes the proc ready for multiple ones.I'm a bit late on this, but you can do :