Use a custom validator
Active Model’s validations, used by calling validates inside your model with various options, can be supplemented with your own custom classes. The Rails Guides contains a section on custom validations.
Use a custom validator #ruby #rubydeveloper #rubyonrails https://rubyonrails.ba/single/use-a-custom-validator