RE: [Rails] Reject a nested object if all parameters of its own nested object are blank

You can write method to validate nested result attributes.

Def valid_nested_results?(results_attributes)

results_attributes.each do|res_attr|
return false if(res_attr['attr1'].blank? and res_attr['attr2'].blank? ....)

return true


And use this method in reject_if instead of attributes['results_attributes'].blank?

Or you can also define the appropriate :reject_if for nested attribute definition for results in treatment model.

Does it help?

oh, it works if you reject the creation of the third-level nested
model in the second-level nested model.