ruby on rails - What is the rationale for `reject_if`? -


i've come across reject_if in cocoon's readme, , in documentation nested attributes. rationale using reject_if when associated active record objects can determine whether they're valid or not?

for nested objects, may not want attempt submit record :all_blank or other reason may want check on. point being, empty or incomplete (in way) object can, way, not built / added nested objects collection.

validations serve different purpose. if empty object, say, fails validation whole form submit fail. reject_if approach allows submission succeed in such case removing object consideration before validations fire.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -