class User < ActiveRecord::Base validates_email_format_of :email end
-
validates_presence_of
-
validates_format_of
-
validates_uniqueness_of
Plus, it includes an extra validation for avoid email-temporary domains like mailinator.com, example:¶ ↑
class User < ActiveRecord::Base validates_email_format_of :email, :invalid_domains => %w(mailmoat.com mailinator.com fakemail.com) end
With the :invalid_domains parameter, any email addresses @mailmoat.com, @mailinator.com or @fakemail.com will be rejected.¶ ↑
-
Make ActiveRecord validations opcionals.