I have a custom Class in my Rails application, which validates a bunch of settings.
class UserSettingObject < RailsSettings::SettingObject
redirect_to settings_path, notice: 'Invalid time format'
In addition to what @SergioTulentsev already said, validations are for validating, not for taking actions. What you could do instead is leaving the regexp as a method, and in controller check the
time using it and redirect based on the result of the validation.