This:
accepts_nested_attributes_for :photo, :reject_if => proc { |attributes| attributes['image'].blank? }, :reject_if => proc { |attributes| attributes['photo_title'].blank? }, :allow_destroy => true
is the same as this:
accepts_nested_attributes_for :photo, { :reject_if => proc { |attributes| attributes['image'].blank? }, :reject_if => proc { |attributes| attributes['photo_title'].blank? }, :allow_destroy => true }
The fat-arrow arguments are actually a Hash, the braces are essentially added by Ruby behind your back. A Hash doesn't allow duplicate keys so the second :reject_if value overwrites the first one and you end up with this:
accepts_nested_attributes_for :photo, :reject_if => proc { |attributes| attributes['photo_title'].blank? }, :allow_destroy => true
You can combine both conditions in one Proc though:
accepts_nested_attributes_for :photo, :reject_if => proc { |attributes| attributes['image'].blank? || attributes['photo_title'].blank? }, :allow_destroy => true
You could also use a separate method:
accepts_nested_attributes_for :photo, :reject_if => :not_all_there, :allow_destroy => true def not_all_there(attributes) attributes['image'].blank? || attributes['photo_title'].blank? end