I'm trying to validate 4 fields with the same validation on the user model as they sign up. I don't want to have to write 4 different methods with the same logic.
I'm validating the following fields first_name, last_name, user_name and nickname. This is what I'm checking
def validate_input
if first_name.present? && first_name.start_with?("=", "@", "-", "+")
first_name.prepend('`')
end
end
How can I go about this method without having to repeat myself 4 times with the same method?