Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails:Email validation in model

I am importing excel sheet containing(name,date of birth,email) and validating email in model with the below code

validates_format_of :email, :with => /^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4})$/, :message => "Invalid email ID"

Now I have to show people having invalid email format.Is it possible to validate with this or any another way....

Thanks in advance

like image 491
Aurick Avatar asked Dec 12 '25 14:12

Aurick


1 Answers

Go through http://my.rails-royce.org/2010/07/21/email-validation-in-ruby-on-rails-without-regexp/ It really helps you.

like image 166
Sachin R Avatar answered Dec 14 '25 06:12

Sachin R



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!