I have an app for which I want to sanitize user inputs before saving it in the database.
I can easily add in all model a function clean
and call it with before_validation :clean
, but my function clean
is generic.
I wanted to know if it exist a way to call this function for all model validations in the app and just declare once.
I have made some research but I haven't find the answer for me, and it bothers me, repeat the function and the before_validation in all my models it's not quite DRY.
Thank you in advance for your responses.
Cheers.