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
I'm a bit late on this, but you can do :
accepts_nested_attributes_for :foo,
reject_if: ->(attributes){
attributes.except(:key).values.all?( &:blank? )
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With