Add helper for clearing blank model attributes before validation
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
- [-] Changelog entry
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
- [-] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Edited by Tiger Watson