I have the following model field validation:
validates_uniqueness_of :acronym, :scope => [:group_id], :case_sensitive => false
The pr
Yes, there are two possible options that you can pass to validations for optional fields: :allow_blank
or :allow_nil
, which will skip the validations on blank
and nil
fields, respectively. If you change your validation to the following, you should get the behaviour you want:
validates_uniqueness_of :acronym, :allow_blank => true, :scope => [:group_id], :case_sensitive => false