It would be good if the hashes returned from form.save had a method that would remove all of the empty hashes. This would save some time spent manually removing all the empty attributes from hashes.
e.g.
form.save do |data, nested|
# do processing with the nested attributes here, run delete_if or whatever ...
# Remove any un-needed empty attributes
nested.remove_empty_attributes!
# or...
nested[:contracts].remove_empty_attributes!
# Create using accepts_nested_attributes_for
Job.create(nested)
end
It would be good if the hashes returned from form.save had a method that would remove all of the empty hashes. This would save some time spent manually removing all the empty attributes from hashes. e.g.
Could this easily be done by subclassing Hash?