Can reject_if be used to reject a nested resource if all fields except one is blank?

nested-attributes, ruby-on-rails-3

Solution

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? ) 
                               }

Problem

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

Original source