mardi 29 décembre 2015

rails model attribute ensure uniqueness except for certain value

In rails, I could restrict certain attribute to be unique within scope but pass on nil or blank. How could I ensure uniqueness but pass on certain value?

I encrypted an attribute, so it's not nil anymore. But I do allow nil for this attribute in the model.

Aucun commentaire:

Enregistrer un commentaire