Skip to content

Add helper for clearing blank model attributes before validation

Tiger Watson requested to merge nullify-if-blank into master

What does this MR do?

Create helper to set blank attributes to nil before validation

Uses a before_validation callback to set configured attributes to nil if they have a truthy response to #blank?, which helps prevent empty strings ending up in the database.

As a proof of concept, adds a use of the helper where we previously did this manually (Clusters::Platforms::Kubernetes#namespace)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Tiger Watson

Merge request reports

Loading