Skip to content

Rails plugin that encapsulates email string validations for ActiveRecord.

Notifications You must be signed in to change notification settings

amedrz/validates_as_email

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Validates the format of a string as a valid email address.

Just put in your Rails model something like:

class User < ActiveRecord::Base validates_email_format_of :email end

And it will take care of validate the string under ActiveRecord validations such:

  • 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.

TODO:

  • Make ActiveRecord validations opcionals.

About

Rails plugin that encapsulates email string validations for ActiveRecord.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages