This question already has an answer here:
I want to validate the input email as right format. This is my current code in the model:
EMAIL_REGEX = /\A[^@]+@([^@\.]+\.)+[^@\.]+\z/
validates :email, :format => {:with => EMAIL_REGEX}, :uniqueness => {case_sensitive:false}
This works fine. However, since the email address is not required. User don't necessarily need to input anything. How can I allow the situation that user let the field blank?
Aucun commentaire:
Enregistrer un commentaire