[ActiveRecord::validations] check CNAME or Empty

Hi I wanna check in my model if the field is conform to a CNAME OR is

I’ve put something like this in my model :

validates_format_of :cname, :with => /^[a-z0-9-]+$/i,
:unless => :cname.strip == ‘’

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs