You can use allow_blank
to skip validation if the field isn't set:
validates :phone, :length => { :is => 9 }, :allow_blank => true
See the Rails validations guide for additional details.
So, for your explicit example:
validates_length_of :phone, :is => 9, :allow_blank => true
Will allow the phone
field to be an empty string or nil, and skip the validation.