Quick tips from the dance floor from a Java specialist, enterprise developer, and mobile technology enthusiast.
Lickety-split custom validations in Rails
Have a highly specific, yet custom validation for a particular field on one of your Rails model objects? Don’t want to create a ActiveModel::Validator type? Not a problem!
You can just as easily create a method that can be invoked as part of the validation process. For example, imagine a field dubbed uri in some model object; this field must begin with a protocol (i.e. http or https). You can create a validation method like so: