I have a field that I would like to validate. I want the field to be able to be left blank, but if a user is entering data I want it to be in a certain format. Currently I am us
From the validates_length_of documentation:
validates_length_of :phone, :in => 7..32, :allow_blank => true
:allow_blank - Attribute may be blank; skip validation.
:allow_blank